do not create empty array in clone
This commit is contained in:
@@ -402,7 +402,7 @@ public class IntList implements Serializable, Cloneable {
|
|||||||
public IntList clone() {
|
public IntList clone() {
|
||||||
try {
|
try {
|
||||||
final IntList result = (IntList) super.clone();
|
final IntList result = (IntList) super.clone();
|
||||||
result.data = Arrays.copyOf(data, index);
|
result.data = index == 0 ? EMPTY_ARRAY : Arrays.copyOf(data, index);
|
||||||
return result;
|
return result;
|
||||||
} catch (final CloneNotSupportedException e) {
|
} catch (final CloneNotSupportedException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user