You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2023/01/06 14:38:33 UTC

[GitHub] [tinkerpop] mikepersonick commented on a diff in pull request #1929: Modifications to mergeV/E semantics

mikepersonick commented on code in PR #1929:
URL: https://github.com/apache/tinkerpop/pull/1929#discussion_r1063486411


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtils.java:
##########
@@ -116,39 +120,64 @@ public S next() {
                     throw FastNoSuchElementException.instance();
                 return iterator.next();
             }
+
+            @Override
+            public void close() {
+                CloseableIterator.closeIterator(iterator);
+            }
         };
     }
 
     ///////////////////
 
     public static <T> boolean allMatch(final Iterator<T> iterator, final Predicate<T> predicate) {
-        while (iterator.hasNext()) {
-            if (!predicate.test(iterator.next())) {
-                return false;
+        try {

Review Comment:
   It's not about exceptions - this class was wrapping iterators inside iterators but not taking proper care / responsibility for closing them. These changes just make sure that one iterator wraps another iterator it closes it properly.



-- 
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: commits-unsubscribe@tinkerpop.apache.org

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