> On 6 Mar 2020, at 02:14, Alex Herbert <alex.d.herb...@gmail.com> wrote:
> 
> The change to make the CountingBloomFilter an interface is in this PR [1].

Claude has stated in a review of the PR on GitHub that the change to 
CountingBloomFilter as an interface is good.

I will now progress to updating the BloomFilter interface as previously 
discussed and put that into a PR. Changes would be:

- boolean return values from the merge operations.
- remove getHasher() and switch to providing an iterator of enabled indexes

As per below:
> *public* *interface* BloomFilter {
> 
>      *int* andCardinality(BloomFilter other);
> 
>      *int* cardinality();
> 
>      *boolean* contains(BloomFilter other);
> 
>      *boolean* contains(Hasher hasher);
> 
>      *long*[] getBits();
> 
>    // Change
>    PrimitiveIterator.OfInt iterator();
> 
>      Shape getShape();
> 
> 
> *   // Change   boolean* merge(BloomFilter other);
> 
> 
> *// Change   boolean* merge(Hasher hasher);
> 
>      *int* orCardinality(BloomFilter other);
> 
>      *int* xorCardinality(BloomFilter other);
> 
> }

Given the CountingBloomFilter provides a forEach(BitCountConsumer) method it 
may be useful to also have the following method to receive all the enabled 
indexes:

forEach(IntConsumer)

Thus you can use the iterator of indexes for fail-fast checking against each 
index, or use the forEach method when you know you want to process all the bit 
indexes. In many cases the forEach can be more efficiently implemented than an 
iterator and would avoid an iterator object creation.


> 
> 
> [1] https://github.com/apache/commons-collections/pull/137
>  <https://github.com/apache/commons-collections/pull/137>

Reply via email to