RandomAccessIntContainer (int count) { int newSize = mySetLength + count; if (newSize < mySet.length) return this; if (newSize > ChangeBufferingList.MAX_FILES) { return new IdBitSet(this, count); } newSize = ChangeBufferingList.calcNextArraySize(mySet.length, newSize); assert newSize < Short.MAX_VALUE; int[] newSet = new int[newSize]; // todo slightly increase size and compact System.arraycopy(mySet, 0, newSet, 0, mySetLength); mySet = newSet; return this; }