SparseSketch extends Sketch<SparseSketch> { @Override public void aggregate(Iterable<Integer> hashValues) { for (int hash: hashValues) { aggregate(hash); } }  @Override void merge(SparseSketch other); @Override void aggregate(Iterable<Integer> hashValues); @Override void aggregate(int hash); HashSet<Integer> data(); int size(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final int classId; }
@Test public void requireThatSerializationRetainAllData() { SparseSketch from = new SparseSketch(); from.aggregate(42); from.aggregate(1337); SparseSketch to = new SparseSketch(); BufferSerializer buffer = new BufferSerializer(); from.serialize(buffer); buffer.flip(); to.deserialize(buffer); assertEquals(from, to); }