/** * Obtain a builder initialized with the first {@code n} elements. * <p> * Copies the first {@code n} elements from this list into a new builder, * which can be used by the caller to add additional elements. * * @param n * the number of elements to copy. * @return a new builder with the first {@code n} elements already added. */ public final Builder<T> copy(int n) { Builder<T> r = new Builder<>(Math.max(16, n)); r.addAll(list, 0, n); return r; }
/** * Obtain a builder initialized with the first {@code n} elements. * <p> * Copies the first {@code n} elements from this list into a new builder, * which can be used by the caller to add additional elements. * * @param n * the number of elements to copy. * @return a new builder with the first {@code n} elements already added. */ public final Builder<T> copy(int n) { Builder<T> r = new Builder<>(Math.max(16, n)); r.addAll(list, 0, n); return r; }
/** * Obtain a builder initialized with the first {@code n} elements. * <p> * Copies the first {@code n} elements from this list into a new builder, * which can be used by the caller to add additional elements. * * @param n * the number of elements to copy. * @return a new builder with the first {@code n} elements already added. */ public final Builder<T> copy(int n) { Builder<T> r = new Builder<T>(Math.max(16, n)); r.addAll(list, 0, n); return r; }