void (int capacity) { if (capacity <= a.length) { return; } if (a != DEFAULT_EMPTY_ARRAY) { capacity = (int)Math.max( Math.min((long)a.length + (a.length >> 1), MAX_ARRAY_SIZE), capacity); } else if (capacity < DEFAULT_INITIAL_CAPACITY) { capacity = DEFAULT_INITIAL_CAPACITY; } a = forceCapacity(a, capacity, size); assert size <= a.length; }