-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
当前的add(byte[] bytes)方法如下:
public void add(byte[] bytes) {
int[] hashes = MessageDigestUtils.createHashes(bytes, k);
for (int hash : hashes)
bitSet.set(Math.abs(hash % bitSetSize), true);
numberOfAddedElements++;
}
这个操作就是,只要往布隆过滤器里面添加元素,那么这个元素个数就加1,如果我们往布隆过滤器里面添加的元素是已经存在的,那么,就不应该加1。
我的方案是,添加之前先判断元素是否存在,如果存在直接跳过,不存在则添加并加1.
Metadata
Metadata
Assignees
Labels
No labels