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() {
|
||||
try {
|
||||
final IntList result = (IntList) super.clone();
|
||||
result.data = Arrays.copyOf(data, index);
|
||||
result.data = index == 0 ? EMPTY_ARRAY : Arrays.copyOf(data, index);
|
||||
return result;
|
||||
} catch (final CloneNotSupportedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
||||
Reference in New Issue
Block a user