bloom过滤器JAVA开源_布隆过滤器Bloom Filters的一个简单Java库

68747470733a2f2f7472617669732d63692e6f72672f6b726973697665732f6a626c6f6f6d65722e7376673f6272616e63683d6d6173746572

jbloomer

A simple Java library for Bloom Filters.

License

See the LICENSE.md for a copy of the BSD 2-clause license.

Download

Grab the Jar from releases and add it to your classpath or buildpath.

Usage

Create a bloom filter by passing how many items you expect to be in the filter and a expected tolerance of false positives to occur.

BloomFilter filter = new BloomFilter(1000, 0.01);

You can add items to the filter by:

int ip = addr.getIpAddress();

filter.add(ip);

Later you can check if a key has been added to the filter:

if (filter.contains(ip)) {

if (expensiveQuery.contains(ip)) {

throw new Exception("IP is blacklisted");

}

}

Bugs

Contributing

If you want to improve jbloomer fork krisives/jbloomer and make your changes then submit a pull request.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值