RankedBitVectorImpl implements RankedBitVector, Iterable<Boolean> { @Override public Iterator<Boolean> iterator() { return this.bitVector.iterator(); } RankedBitVectorImpl();  RankedBitVectorImpl(BitVector bitVector);  RankedBitVectorImpl(long initialSize);  RankedBitVectorImpl(long initialSize, int countBlockSize,
			int findPositionBlockSize); @Override boolean addBit(boolean bit); @Override long countBits(boolean bit, long position); @Override boolean equals(Object obj); @Override long findPosition(boolean bit, long nOccurrence); @Override boolean getBit(long position); @Override int hashCode(); @Override Iterator<Boolean> iterator(); @Override void setBit(long position, boolean bit); @Override long size(); @Override String toString();  }
@Test public void testIterator() { RankedBitVectorImpl bv = new RankedBitVectorImpl(new BitVectorImpl()); PseudorandomBooleanGenerator generator = new PseudorandomBooleanGenerator( 0x7531); Assert.assertEquals(0, bv.size()); for (int i = 0; i < 0x300; i++) { bv.addBit(generator.getPseudorandomBoolean()); } Iterator<Boolean> it = bv.iterator(); for (int i = 0; i < 0x300; i++) { boolean value = it.next(); Assert.assertEquals(bv.getBit(i), value); } Assert.assertFalse(it.hasNext()); }