Skip to content

Commit a048c23

Browse files
authored
Merge pull request #2779 from iamatsea/patch-1
Optimize contains method in bloom filter
2 parents 07fc323 + 0e9b4f3 commit a048c23

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/cs-basics/data-structure/bloom-filter.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ public class MyBloomFilter {
130130
public boolean contains(Object value) {
131131
boolean ret = true;
132132
for (SimpleHash f : func) {
133-
ret = ret && bits.get(f.hash(value));
133+
ret = bits.get(f.hash(value));
134+
if(!ret)
135+
return ret;
134136
}
135137
return ret;
136138
}

0 commit comments

Comments
 (0)