/** * Trims this array list so that the capacity is equal to the size. * * @see java.util.ArrayList#trimToSize() */ public void trim() { trim(0); } /**
/** * Pours an iterator, returning a type-specific list, with a limit on the number * of elements. * * <p> * This method iterates over the given type-specific iterator and returns a * type-specific list containing the returned elements (up to {@code max}). * Iteration on the returned list is guaranteed to produce the elements in the * same order in which they appeared in the iterator. * * * @param i * a type-specific iterator. * @param max * the maximum number of elements to be poured. * @return a type-specific list containing the returned elements, up to * {@code max}. */ public static ByteList pour(final ByteIterator i, int max) { final ByteArrayList l = new ByteArrayList(); pour(i, l, max); l.trim(); return l; } /**