@Override public boolean add(final long k) { synchronized (sync) { return collection.add(k); } } @Override
@Override @Deprecated public boolean add(final Long k) { synchronized (sync) { return collection.add(k); } } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @SuppressWarnings("deprecation") @Deprecated @Override default boolean add(final Long o) { return LongCollection.super.add(o); } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @SuppressWarnings("deprecation") @Deprecated @Override public boolean add(final Long key) { return LongCollection.super.add(key); } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default boolean add(final Long key) { return add((key).longValue()); } /**
/** * Pours an iterator into a type-specific collection, with a limit on the number * of elements. * * <p> * This method iterates over the given type-specific iterator and adds the * returned elements to the given collection (up to {@code max}). * * @param i * a type-specific iterator. * @param s * a type-specific collection. * @param max * the maximum number of elements to be poured. * @return the number of elements poured. Note that this is the number of * elements returned by the iterator, which is not necessarily the * number of elements that have been added to the collection (because of * duplicates). */ public static int pour(final LongIterator i, final LongCollection s, final int max) { if (max < 0) throw new IllegalArgumentException("The maximum number of elements (" + max + ") is negative"); int j = max; while (j-- != 0 && i.hasNext()) s.add(i.nextLong()); return max - j - 1; } /**
int j = max; while (j-- != 0 && i.hasNext()) c.add(i.nextLong()); return max - j - 1;
/** * Unwraps an iterator into a type-specific collection. * * <p> * This method iterates over the given type-specific iterator and stores the * elements returned in the given type-specific collection. The returned count * on the number unwrapped elements is a long, so that it will work also with * very large collections. * * @param i * a type-specific iterator. * @param c * a type-specific collection to contain the output of the iterator. * @return the number of elements unwrapped. Note that this is the number of * elements returned by the iterator, which is not necessarily the * number of elements that have been added to the collection (because of * duplicates). */ public static long unwrap(final LongIterator i, final LongCollection c) { long n = 0; while (i.hasNext()) { c.add(i.nextLong()); n++; } return n; } /**