FastEnumSet extends FastEnumBase<T> implements RunnerLoop<T>, Set<T>, BitSetLong { @Override public boolean add(final T item) { final long mask = item.mask(); long bitSet = this.bitSet; final boolean wasEmpty = (bitSet & mask) == NUL; bitSet |= mask; this.bitSet = bitSet; return wasEmpty; } protected  FastEnumSet(final T[] values); protected  FastEnumSet(final T[] values, final long bitSet); protected  FastEnumSet(final T[] values, final FastEnumSet<T> enumSet); protected  FastEnumSet(final T[] values, final T... items); @Override void clear(); @Override boolean add(final T item); @Override boolean remove(final Object item); @Override Iterator<T> iterator(); @Override final boolean isEmpty(); @Override final boolean contains(final Object item); @ThreadSafe(rule = "does not reflect concurrent modifications") @Override void runLoop(final Runner<R, T> task, final List<R> list); @Override final int size(); @Override boolean addAll(final Collection<? extends T> c); @Override boolean containsAll(final Collection<?> c); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); @Override Object[] toArray(); @Override X[] toArray(final X[] a); @Override final long bitMaskAnd(final long bits); @Override final long bitMaskOr(final long bits); @Override final long bitMaskXor(final long bits); @Override final long bitSet(); @Override final long bitSet(final long bits);  }
@Test public void testBitSetFast0() { final Set<E1> set = new FastEnumSet<E1>(E1.values()); int count; count = 0; for (final E1 event : set) { count++; out.println(event); } assertEquals(count, 0); set.add(E1.a); set.add(E1.c); count = 0; for (final E1 event : set) { count++; out.println(event.mask()); } assertEquals(count, 2); }