Guava BloomFilter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava BloomFilter class.

This code example shows how to use the following methods:mightContain, put
 
    private final BloomFilter<CharSequence> bloomFilter;
 
    @Override 
    public boolean isDuplicate(Request request, Task task) {
        boolean isDuplicate = bloomFilter.mightContain(getUrl(request));
        if (!isDuplicate) {
            bloomFilter.put(getUrl(request));
            counter.incrementAndGet();
        } 
        return isDuplicate;
    } 
 
    protected String getUrl(Request request) {
        return request.getUrl(); 
    } 
 
    @Override 
    public void resetDuplicateCheck(Task task) {
        rebuildBloomFilter(); 
6
CodeRank
This code example shows how to use the following methods:mightContain
		Preconditions.checkArgument(key != null && key.length > 0, "Key is empty");
		Preconditions.checkArgument(this.getAppendedSize() >= 1, "the map table is empty");
		GetResult result = new GetResult();
 
		// leverage bloom filter for guarded condition 
		if (!this.bloomFilter.mightContain(key)) return result;
 
		IMapEntry mapEntry = this.binarySearch(key);
		if (mapEntry == null) return result;
		else { 
			if (mapEntry.isCompressed()) {
				result.setValue(Snappy.uncompress(mapEntry.getValue()));
			} else { 
				result.setValue(mapEntry.getValue());
			} 
			if (mapEntry.isDeleted()) {
				result.setDeleted(true);
				return result;
			} 
			if (mapEntry.isExpired()) {
3
CodeRank
See Code Examples for Guava BloomFilter Methods: