approximateCount

public int approximateCount(long item)

This method returns the approximate number of times an item was added to the filter. This count is probabilistic like the rest of the filter, so it may occasionally over-count. Since the filter has no false negatives, the approximate count will always be equal or greater than the actual count(unless you've been deleting non-existent items). That is, this method may return a higher count than the true value, but never lower. The false inflation chance of the count depends on the filter's false positive rate, but is generally low for sane configurations.

NOTE: Inserting the same key more than 7 times will cause a bucket overflow, greatly decreasing the performance of the filter and making early insertion failure (less than design load factor) very likely. For this reason the filter should only be used to count small values.

Also note that getting the count is generally about half as fast as checking if a filter contains an item.

Return

Returns a positive integer representing the number of times an item was probably added to the filter. Returns zero if the item is not in the filter, behaving exactly like #mightContain(Object) in this case.

Parameters

item

item to check