|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.common.hash.BloomFilter<T>
T
- the type of instances that the BloomFilter
accepts@Beta public final class BloomFilter<T>
A Bloom filter for instances of T
. A Bloom filter offers an approximate containment test
with one-sided error: if it claims that an element is contained in it, this might be in error,
but if it claims that an element is not contained in it, then this is definitely true.
If you are unfamiliar with Bloom filters, this nice tutorial may help you understand how they work.
Method Summary | ||
---|---|---|
static
|
create(Funnel<T> funnel,
int expectedInsertions)
Creates a Builder of a BloomFilter , with the expected number
of insertions, and a default expected false positive probability of 3%. |
|
static
|
create(Funnel<T> funnel,
int expectedInsertions,
double falsePositiveProbability)
Creates a Builder of a BloomFilter , with the expected number
of insertions and expected false positive probability. |
|
boolean |
mightContain(T object)
Returns true if the element might have been put in this Bloom filter,
false if this is definitely not the case. |
|
void |
put(T object)
Puts an element into this BloomFilter . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean mightContain(T object)
true
if the element might have been put in this Bloom filter,
false
if this is definitely not the case.
public void put(T object)
BloomFilter
. Ensures that subsequent invocations of
mightContain(Object)
with the same element will always return true
.
public static <T> BloomFilter<T> create(Funnel<T> funnel, int expectedInsertions, double falsePositiveProbability)
Builder
of a BloomFilter
, with the expected number
of insertions and expected false positive probability.
Note that overflowing a BloomFilter
with significantly more elements
than specified, will result in its saturation, and a sharp deterioration of its
false positive probability.
The constructed BloomFilter<T>
will be serializable if the provided
Funnel<T>
is.
funnel
- the funnel of T's that the constructed BloomFilter<T>
will useexpectedInsertions
- the number of expected insertions to the constructed
BloomFilter<T>
; must be positivefalsePositiveProbability
- the desired false positive probability (must be positive and
less than 1.0)
Builder
public static <T> BloomFilter<T> create(Funnel<T> funnel, int expectedInsertions)
Builder
of a BloomFilter
, with the expected number
of insertions, and a default expected false positive probability of 3%.
Note that overflowing a BloomFilter
with significantly more elements
than specified, will result in its saturation, and a sharp deterioration of its
false positive probability.
The constructed BloomFilter<T>
will be serializable if the provided
Funnel<T>
is.
funnel
- the funnel of T's that the constructed BloomFilter<T>
will useexpectedInsertions
- the number of expected insertions to the constructed
BloomFilter<T>
; must be positive
Builder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |