CountingBytesSource extends AbstractChainedSource<byte[], byte[], byte[], byte[]> implements HashedKeySource<byte[], byte[]> { @Override public void put(byte[] key, byte[] val) { if (val == null) { delete(key); return; } synchronized (this) { byte[] srcVal = getSource().get(key); int srcCount = decodeCount(srcVal); if (srcCount >= 1) { if (filter != null) filter.insert(key); dirty = true; } getSource().put(key, encodeCount(val, srcCount + 1)); } } CountingBytesSource(Source<byte[], byte[]> src);  CountingBytesSource(Source<byte[], byte[]> src, boolean bloom); @Override void put(byte[] key, byte[] val); @Override byte[] get(byte[] key); @Override void delete(byte[] key);  }
@Test(expected = NullPointerException.class) public void testKeyNull() { src.put(null, null); }