ScalableBloomFilter implements Serializable { public static Builder withMaximumNumberOfInsertionsForOptimalBloomFilter( long maximumBloomFilterInsertionsForOptimalBloomFilter) { checkArgument( maximumBloomFilterInsertionsForOptimalBloomFilter > 0, "Expected Bloom filter insertion limit to be positive."); checkArgument( maximumBloomFilterInsertionsForOptimalBloomFilter <= MAX_ELEMENTS, "The specified size is larger than the maximum supported size of 2^63 elements."); return new Builder(maximumBloomFilterInsertionsForOptimalBloomFilter); } private  ScalableBloomFilter(BloomFilter<ByteBuffer> bloomFilter); boolean mightContain(byte[] buf, int offset, int length); boolean mightContain(ByteBuffer byteBuffer); @Override boolean equals(@Nullable Object other); @Override int hashCode(); @Override String toString(); static Builder withMaximumSizeBytes(long maxBloomFilterSizeBytes); static Builder withMaximumNumberOfInsertionsForOptimalBloomFilter(
      long maximumBloomFilterInsertionsForOptimalBloomFilter);  }
@Test public void testScalableBloomFilterCoder() throws Exception { Builder builderA = ScalableBloomFilter.withMaximumNumberOfInsertionsForOptimalBloomFilter(16); builderA.put(BUFFER); ScalableBloomFilter filterA = builderA.build(); Builder builderB = ScalableBloomFilter.withMaximumNumberOfInsertionsForOptimalBloomFilter(16); builderB.put(BUFFER); ScalableBloomFilter filterB = builderB.build(); CoderProperties.coderDecodeEncodeEqual(ScalableBloomFilterCoder.of(), filterA); CoderProperties.coderDeterministic(ScalableBloomFilterCoder.of(), filterA, filterB); CoderProperties.coderConsistentWithEquals(ScalableBloomFilterCoder.of(), filterA, filterB); CoderProperties.coderSerializable(ScalableBloomFilterCoder.of()); CoderProperties.structuralValueConsistentWithEquals( ScalableBloomFilterCoder.of(), filterA, filterB); }