aherbert commented on code in PR #492:
URL: 
https://github.com/apache/commons-collections/pull/492#discussion_r1605137828


##########
src/main/java/org/apache/commons/collections4/bloomfilter/BitMapExtractor.java:
##########
@@ -61,33 +61,33 @@ public boolean forEachBitMap(final LongPredicate predicate) 
{
             }
 
             @Override
-            public boolean forEachBitMapPair(final BitMapProducer other, final 
LongBiPredicate func) {
+            public boolean processBitMapPairs(final BitMapExtractor other, 
final LongBiPredicate func) {
                 final CountingLongPredicate p = new 
CountingLongPredicate(bitMaps, func);
-                return other.forEachBitMap(p) && p.forEachRemaining();
+                return other.processBitMaps(p) && p.processRemaining();
             }
         };
     }
 
     /**
-     * Creates a BitMapProducer from an IndexProducer.
-     * @param producer the IndexProducer that specifies the indexes of the 
bits to enable.
+     * Creates a BitMapExtractor from an IndexExtractor.
+     * @param extractor the IndexExtractor that specifies the indexes of the 
bits to enable.
      * @param numberOfBits the number of bits in the Bloom filter.
-     * @return A BitMapProducer that produces the bit maps equivalent of the 
Indices from the producer.
+     * @return A BitMapExtractor that produces the bit maps equivalent of the 
Indices from the extractor.
      */
-    static BitMapProducer fromIndexProducer(final IndexProducer producer, 
final int numberOfBits) {
-        Objects.requireNonNull(producer, "producer");
+    static BitMapExtractor fromIndexExtractor(final IndexExtractor extractor, 
final int numberOfBits) {
+        Objects.requireNonNull(extractor, "extractor");
         Objects.requireNonNull(numberOfBits, "numberOfBits");
 
-        final long[] result = new long[BitMap.numberOfBitMaps(numberOfBits)];
-        producer.forEachIndex(i -> {
-            BitMap.set(result, i);
+        final long[] result = new long[BitMaps.numberOfBitMaps(numberOfBits)];
+        extractor.processIndices(i -> {
+            BitMaps.set(result, i);

Review Comment:
   To return a result would require reading the bit before setting it to 1. 
This is an unwanted overhead in the common case where you set the bit and don't 
care if it was already set.
   
   Possibly better served in the future by:
   ```java
       public static boolean getAndSet(final long[] bitMaps, final int 
bitIndex) {
           // read value, set value as true, return previous value (true/false)
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to