public static <T> boolean anyMatch(final Iterator<T> iterator, final Predicate<T> predicate) {
        try {
            while (iterator.hasNext()) {
                if (predicate.test(iterator.next())) {
                    return true;
                }
            }
            return false;
        } finally {
            CloseableIterator.closeIterator(iterator);
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtils.java