You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/11/06 11:15:33 UTC

[GitHub] [commons-collections] kinow commented on a diff in pull request #357: Added Hasher.isEmpty() and appropriate tests

kinow commented on code in PR #357:
URL: https://github.com/apache/commons-collections/pull/357#discussion_r1014810732


##########
src/main/java/org/apache/commons/collections4/bloomfilter/HasherCollection.java:
##########
@@ -66,6 +66,16 @@ public HasherCollection(Hasher... hashers) {
         this(Arrays.asList(hashers));
     }
 
+    @Override
+    public boolean isEmpty() {
+        for (Hasher h : hashers) {
+            if (!h.isEmpty()) {
+                return false;
+            }
+        }
+        return true;
+    }

Review Comment:
   Bit rusty with Java & streams, but I **think** this is equivalent to:
   
   ```java
   return hashers.stream().noneMatch(Hasher::isEmpty);
   ```



-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org