@Override public boolean test(E x) { return add(x); } };
public LongHashSet(long[] items, long missingValue) { this(items.length, missingValue); for (long item : items) { add(item); } }
@Override public boolean test(E x) { return add(x); } };
public LongHashSet(long[] items, long missingValue) { this(items.length, missingValue); for (long item : items) { add(item); } }
/** * {@inheritDoc} */ public boolean add(final Long value) { return add(value.longValue()); }
/** * {@inheritDoc} */ public boolean add(final Long value) { return add(value.longValue()); }
/** * Fast Path set difference for comparison with another LongHashSet. * <p/> * NB: garbage free in the identical case, allocates otherwise. * * @param collection the other set to subtract * @return null if identical, otherwise the set of differences */ public LongHashSet difference(final LongHashSet collection) { checkNotNull(collection); LongHashSet difference = null; final LongIterator it = iterator(); while (it.hasNext()) { final long value = it.nextValue(); if (!collection.contains(value)) { if (difference == null) { difference = new LongHashSet(size, missingValue); } difference.add(value); } } return difference; }
/** * Fast Path set difference for comparison with another LongHashSet. * <p/> * NB: garbage free in the identical case, allocates otherwise. * * @param collection the other set to subtract * @return null if identical, otherwise the set of differences */ public LongHashSet difference(final LongHashSet collection) { checkNotNull(collection); LongHashSet difference = null; final LongIterator it = iterator(); while (it.hasNext()) { final long value = it.nextValue(); if (!collection.contains(value)) { if (difference == null) { difference = new LongHashSet(size, missingValue); } difference.add(value); } } return difference; }