public final class BloomFilter extends Object implements Membership
| Constructor and Description |
|---|
BloomFilter()
Creates a lazily initialized membership sketch, requiring
ensureCapacity(long, double) be called
when the expected number of insertions and the false positive probability have been determined. |
BloomFilter(Config config)
Creates a membership sketch based on the expected number of insertions and the false positive
probability.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all of the elements from this collection.
|
void |
ensureCapacity(@NonNegative long expectedInsertions,
@NonNegative double fpp)
Initializes and increases the capacity of this BloomFilter instance, if necessary,
to ensure that it can accurately estimate the membership of elements given the expected
number of insertions.
|
boolean |
mightContain(long e)
Returns if the element might have been put in this Bloom filter,
false if this
is definitely not the case. |
boolean |
put(long e)
Puts an element into this collection so that subsequent queries with the same element will
return
true. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdisabledpublic BloomFilter()
ensureCapacity(long, double) be called
when the expected number of insertions and the false positive probability have been determined.public BloomFilter(Config config)
public void ensureCapacity(@NonNegative long expectedInsertions,
@NonNegative double fpp)
expectedInsertions - the number of expected insertionsfpp - the false positive probability, where 0.0 > fpp < 1.0public boolean mightContain(long e)
Membershipfalse if this
is definitely not the case.mightContain in interface Membershipe - the element whose presence is to be testedpublic void clear()
Membershipclear in interface Membershippublic boolean put(long e)
Membershiptrue.put in interface Membershipe - the element to add