performance: the last index case

This commit is contained in:
Gregory.Shrago
2012-10-19 02:05:23 +04:00
parent 1d3ebd3895
commit 0cd44e5f3b
@@ -57,7 +57,7 @@ public class LimitedPool<T> {
}
private void ensureCapacity() {
if (storage.length <= index + 1) {
if (storage.length <= index) {
int newCapacity = Math.min(capacity, storage.length * 3 / 2);
Object[] newStorage = new Object[newCapacity];
System.arraycopy(storage, 0, newStorage, 0, storage.length);