/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * Sets the capacity of this vector to be the same as the size. * * @see #capacity * @see #ensureCapacity * @see #size */ public synchronized void trimToSize() { if (elementData.length != elementCount) { grow(elementCount); } }
/** * This implements the unsynchronized semantics of ensureCapacity. * Synchronized methods in this class can internally call this * method for ensuring capacity without incurring the cost of an * extra synchronization. * * @see #ensureCapacity(int) */ private void ensureCapacityHelper(int minCapacity) { // overflow-conscious code if (minCapacity - elementData.length > 0) grow(minCapacity); }
/** * This implements the unsynchronized semantics of ensureCapacity. * Synchronized methods in this class can internally call this * method for ensuring capacity without incurring the cost of an * extra synchronization. * * @see #ensureCapacity(int) */ private void ensureCapacityHelper(int minCapacity) { // overflow-conscious code if (minCapacity - elementData.length > 0) grow(minCapacity); }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
/** * Ensures that this vector can hold the specified number of elements * without growing. * * @param minimumCapacity * the minimum number of elements that this vector will hold * before growing. * @see #capacity */ public synchronized void ensureCapacity(int minimumCapacity) { if (elementData.length < minimumCapacity) { int next = (capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }