@Override public boolean test(E x) { return add(x); } };
@Override public boolean test(E x) { return add(x); } };
@Override public boolean add(final Integer value) { return add(value.intValue()); }
@Override public boolean add(final Integer value) { return add(value.intValue()); }
/** * Fast Path set difference for comparison with another IntHashSet. * <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 IntHashSet difference(final IntHashSet collection) { checkNotNull(collection, "Collection must not be null"); IntHashSet difference = null; final IntIterator it = iterator(); while (it.hasNext()) { final int value = it.nextValue(); if (!collection.contains(value)) { if (difference == null) { difference = new IntHashSet(size, missingValue); } difference.add(value); } } return difference; }
/** * Fast Path set difference for comparison with another IntHashSet. * <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 IntHashSet difference(final IntHashSet collection) { checkNotNull(collection, "Collection must not be null"); IntHashSet difference = null; final IntIterator it = iterator(); while (it.hasNext()) { final int value = it.nextValue(); if (!collection.contains(value)) { if (difference == null) { difference = new IntHashSet(size, missingValue); } difference.add(value); } } return difference; }