/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** * Trims the underlying heap array so that it has exactly {@link #size()} * elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** * Trims the underlying array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { heap = IntArrays.trim(heap, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** Trims the backing array so that it has exactly {@link #size()} elements. */ public void trim() { array = IntArrays.trim(array, size); } @Override
/** * Sets the length of the given array. * * @param array * an array. * @param length * the new length for the array. * @return {@code array}, if it contains exactly {@code length} entries; * otherwise, if it contains <em>more</em> than {@code length} entries, * an array with {@code length} entries whose entries are the same as * the first {@code length} entries of {@code array}; otherwise, an * array with {@code length} entries whose first {@code array.length} * entries are the same as those of {@code array}. * */ public static int[] setLength(final int[] array, final int length) { if (length == array.length) return array; if (length < array.length) return trim(array, length); return ensureCapacity(array, length); } /**
/** Unwraps the elements returned by a lazy iterator into a new array. * * <p>If you need the resulting array to contain the * elements returned by <code>lazyIntIterator</code>, but some more elements set to zero * would cause no harm, consider using {@link #unwrapLoosely(LazyIntIterator)}, which * usually avoids a final call to {@link IntArrays#trim(int[], int)}. * * @param lazyIntIterator a lazy integer iterator. * @return an array containing the elements returned by <code>lazyIntIterator</code>. * @see #unwrapLoosely(LazyIntIterator) */ public static int[] unwrap(final LazyIntIterator lazyIntIterator) { int array[] = new int[16]; int j = 0, t; while((t = lazyIntIterator.nextInt()) != -1) { if (j == array.length) array = IntArrays.grow(array, j + 1); array[j++] = t; } return IntArrays.trim(array, j); }