Skip to content

BloomFilterImpl

BloomFilterImpl is a BloomFilter.

Creating Instance

BloomFilterImpl takes the following to be created:

  • numHashFunctions
  • Number of bits (to create a BitArray or BitArray directly)

BloomFilterImpl is created when:

mightContainLong

BloomFilter
boolean mightContainLong(
  long item)

mightContainLong is part of the BloomFilter abstraction.

mightContainLong uses Murmur3_x86_32 to generate two hashes of the given item with two different seeds: 0 and the hash result of the first hashing.

mightContainLong requests the BitArray for the number of bits (bitSize).

In the end, mightContainLong checks out if the bit for the hashes (combined) is set (non-zero) in the BitArray up to numHashFunctions times. With all the bits checked and set, mightContainLong is positive. Otherwise, mightContainLong is negative.