public Long next() { return nextValue(); }
public Long next() { return nextValue(); }
/** * {@inheritDoc} */ public int hashCode() { final LongIterator iterator = iterator(); int total = 0; while (iterator.hasNext()) { // Cast exists for substitutions total += (long) iterator.nextValue(); } return total; }
/** * {@inheritDoc} */ public int hashCode() { final LongIterator iterator = iterator(); int total = 0; while (iterator.hasNext()) { // Cast exists for substitutions total += (long) iterator.nextValue(); } return total; }
/** * LongHashSet specialised variant of {this#containsAll(Collection)}. * * @param other the long hashset to compare against. * @return true if every element in other is in this. */ public boolean containsAll(final LongHashSet other) { final LongIterator iterator = other.iterator(); while (iterator.hasNext()) { if (!contains(iterator.nextValue())) { return false; } } return true; }
/** * LongHashSet specialised variant of {this#containsAll(Collection)}. * * @param other the long hashset to compare against. * @return true if every element in other is in this. */ public boolean containsAll(final LongHashSet other) { final LongIterator iterator = other.iterator(); while (iterator.hasNext()) { if (!contains(iterator.nextValue())) { return false; } } return true; }
/** * 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; }