BloomFilter

@SerialVersionUID(1L) class BloomFilter[@specialized(Int, Long) T](val numBuckets: Int, val numHashFunctions: Int, val bits: BitSet) extends T => Boolean with Serializable

A BloomFilter is an approximate set that sometimes gives false positives. That is, if bf(x) returns true, then it might have been added to the set. If it returns false, then it definitely has not. This is useful for caching and approximation.

Companion
object
trait Serializable
trait T => Boolean
class Object
trait Matchable
class Any

Value members

Constructors

def this(numBuckets: Int, numHashFunctions: Int)
def this(numBuckets: Int)

Concrete methods

def &(that: BloomFilter[T]): BloomFilter[T]
def &=(that: BloomFilter[T]): BloomFilter[T]
def &~(that: BloomFilter[T]): BloomFilter[T]
def &~=(that: BloomFilter[T]): BloomFilter[T]
def +=(o: T): BloomFilter[T]
def apply(o: T): Boolean
def contains(o: T): Boolean
override def equals(other: Any): Boolean
Definition Classes
Any
override def hashCode(): Int
Definition Classes
Any
def load: Double

Calculates the load of the bloom filter. If this is near 1, there will be lots of false positives.

Calculates the load of the bloom filter. If this is near 1, there will be lots of false positives.

Returns

the fraction of bits that are set

def |(that: BloomFilter[T]): BloomFilter[T]
def |=(that: BloomFilter[T]): BloomFilter[T]

Inherited methods

@unspecialized
def andThen[A](g: Boolean => A): T => A
Inherited from
Function1
@unspecialized
def compose[A](g: A => T): A => Boolean
Inherited from
Function1
override def toString(): String
Definition Classes
Function1 -> Any
Inherited from
Function1

Concrete fields

val bits: BitSet
val numBuckets: Int