The Guava-Probably project provides two probabilistic filters for Guava.
A probabilistic filter is a space-efficient data structure for representing a set in order to support membership queries. ref
Check out this sweet, interactive demo: Probabilistic Filters By Example
Probabilistic filters are great for reducing unnecessary disk, database or network queries. Applications where the universe of possible members in a set is much larger than actual members may benefit from probabilistic filters, especially when most membership queries are expected to return false.
- Google Chrome uses p-filters to make a preliminary decision whether a particular web site is malicious or safe. ref
- Exim mail transfer agent uses p-filters in its rate-limiting logic. ref
- Use a p-filter to reject malicious authentication attempts, protecting your cache and database from botnet queries.
Requires JDK 8 or higher and Google Guava 19.0 or higher (as of 1.0).
1.0
: API Docs, 05 July 2019.
To add a dependency on Guava-Probably using Maven, use the following:
<dependency>
<groupId>com.duprasville.guava</groupId>
<artifactId>guava-probably</artifactId>
<version>1.0</version>
</dependency>
To add a dependency using Gradle:
dependencies {
compile 'com.duprasville.guava:guava-probably:1.0'
}