IntBag implements AnyBag<IntBag> { @Override public void clear() { int[] buffer = this.buffer; for (int i = 0, n = buffer.length; i < n; ++i) buffer[i] = 0; } IntBag(); @Override void copyFrom(IntBag from); @Override void copyFrom(IntBag from, boolean clearExceeding); @Override void copyFrom(IntBag from, int length); @Override void copyFrom(IntBag from, int length, boolean clearExceeding); @Override void copyFrom(IntBag from, int fromOffset, int length); @Override void copyFrom(IntBag from, int fromOffset, int length, boolean clearExceeding); @Override void copyPartFrom(IntBag from, int fromOffset, int toOffset, int length); @Override void ensureCapacity(int capacity); int get(int index); void set(int index, int value); @Override void clear(); @Override void clear(Mask mask); @Experimental
    public int[] buffer; }
@Test public void testClear() { IntBag bag; bag = new IntBag(); bag.set(0, 1); bag.set(1, 1); bag.set(63, 1); bag.clear(); assertEquals((Integer) 0, (Integer) bag.get(0)); assertEquals((Integer) 0, (Integer) bag.get(1)); assertEquals((Integer) 0, (Integer) bag.get(63)); assertEquals(64, bag.buffer.length); Mask mask = new Mask(); bag = new IntBag(); bag.set(0, 1); bag.set(1, 1); bag.set(63, 1); mask.set(63); mask.set(0); bag.clear(mask); assertEquals((Integer) 0, (Integer) bag.get(0)); assertNotEquals((Integer) 0, (Integer) bag.get(1)); assertEquals((Integer) 0, (Integer) bag.get(63)); mask.set(1); mask.set(457); bag.clear(mask); assertEquals((Integer) 0, (Integer) bag.get(0)); assertEquals((Integer) 0, (Integer) bag.get(1)); assertEquals((Integer) 0, (Integer) bag.get(63)); assertEquals(64, bag.buffer.length); }