add special implementation for add

The special implementation does not need to allocate an array for the
varargs of addAll
This commit is contained in:
2017-09-28 18:22:16 +02:00
parent 4da0726185
commit 4a762f39b9
2 changed files with 11 additions and 8 deletions

View File

@@ -112,9 +112,10 @@ public class IntList {
* the value to add
*/
public void add(final int value) {
// TODO add a special implementation that does not
// need to allocate an array for the varargs of addAll
addAll(value);
ensureCapacity(1);
data[index] = value;
index++;
}
/**