BitVectorImpl implements BitVector, Iterable<Boolean> { @Override public int hashCode() { if (!this.validHashCode) { this.hashCode = computeHashCode(); this.validHashCode = true; } return this.hashCode; } BitVectorImpl();  BitVectorImpl(BitVector bitVector);  BitVectorImpl(long initialSize); @Override boolean addBit(boolean bit); @Override boolean equals(Object obj); @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 testHashCode() { { BitVectorImpl bv = new BitVectorImpl(); Assert.assertEquals(0, bv.hashCode()); bv.addBit(false); Assert.assertEquals(1, bv.hashCode()); } { BitVectorImpl bv = new BitVectorImpl(); Assert.assertEquals(0, bv.hashCode()); bv.addBit(true); Assert.assertEquals(0x20, bv.hashCode()); } }