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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]