allocate only as much as is needed
ensureCapacity would allocate up to 50% too much memory
This commit is contained in:
@@ -1065,7 +1065,7 @@ public final class IntList implements Serializable, Cloneable {
|
||||
// TODO use a more efficient algorithm. Especially the removeIf is too
|
||||
// expensive, because of all the method calls
|
||||
final IntList result;
|
||||
result = new IntList();
|
||||
result = new IntList(a.size() + b.size());
|
||||
result.addAll(a);
|
||||
result.addAll(b);
|
||||
result.sort();
|
||||
|
||||
Reference in New Issue
Block a user