Enum Class BloomFilterStrategies

java.lang.Object
java.lang.Enum<BloomFilterStrategies>
com.google.common.hash.BloomFilterStrategies
All Implemented Interfaces:
BloomFilter.Strategy, Serializable, Comparable<BloomFilterStrategies>, Constable

enum BloomFilterStrategies extends Enum<BloomFilterStrategies> implements BloomFilter.Strategy
Collections of strategies of generating the k * log(M) bits required for an element to be mapped to a BloomFilter of M bits and k hash functions. These strategies are part of the serialized form of the Bloom filters that use them, thus they must be preserved as is (no updates allowed, only introduction of new versions).

Important: the order of the constants cannot change, and they cannot be deleted - we depend on their ordinal for BloomFilter serialization.

  • Enum Constant Details

    • MURMUR128_MITZ_32

      public static final BloomFilterStrategies MURMUR128_MITZ_32
      See "Less Hashing, Same Performance: Building a Better Bloom Filter" by Adam Kirsch and Michael Mitzenmacher. The paper argues that this trick doesn't significantly deteriorate the performance of a Bloom filter (yet only needs two 32bit hash functions).
    • MURMUR128_MITZ_64

      public static final BloomFilterStrategies MURMUR128_MITZ_64
      This strategy uses all 128 bits of Hashing.murmur3_128(int) when hashing. It looks different from the implementation in MURMUR128_MITZ_32 because we're avoiding the multiplication in the loop and doing a (much simpler) += hash2. We're also changing the index to a positive number by AND'ing with Long.MAX_VALUE instead of flipping the bits.
  • Constructor Details

    • BloomFilterStrategies

      private BloomFilterStrategies()
  • Method Details

    • values

      public static BloomFilterStrategies[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BloomFilterStrategies valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null