Class BloomFilter<E>

    • Method Detail

      • createConcurrentFilter

        public static <E> BloomFilter<E> createConcurrentFilter​(int bitsToUse,
                                                                Iterable<ToIntFunction<? super E>> hashFunctions)
        Same as createFilter(int, Iterable) except the returned {code BloomFilter} instance may be used concurrently without additional synchronization.

        The provided function iterable must be able to be iterated upon concurrently.

        Type Parameters:
        E -
        Parameters:
        bitsToUse -
        hashFunctions -
        Returns:
      • addToFilter

        public boolean addToFilter​(E value)
        Adds a value to the filter setting up to a number of bits equal to the number of hash functions. This method will also return {code true} if any of the bits were updated, meaning this value was for sure not present before.
        Parameters:
        value - the value to add to the filter
        Returns:
        whether the filter was actually updated
      • possiblyPresent

        public boolean possiblyPresent​(E value)
        Returns true if the element might be present, false if the value was for sure not present.
        Parameters:
        value - the value to check for
        Returns:
        whether this value may be present or for sure not
      • setBits

        public void setBits​(IntSet intSet)
        Clears all current bits and sets them to the values in the provided IntSet. Since this method clears and sets the values any other concurrent operations may be ignored.
        Parameters:
        intSet -
      • getIntSet

        public IntSet getIntSet()
      • toString

        public String toString()