private <E extends Element> Iterator<E> iteratorList(final Iterator<E> iterator) {
        final List<E> list = new ArrayList<>();

        try {
            while (iterator.hasNext()) {
                final E e = iterator.next();
                try {
                    if (HasContainer.testAll(e, this.hasContainers))
                        list.add(e);
                } catch (GremlinTypeErrorException ex) {
                    if (getTraversal().isRoot() || !(getTraversal().getParent() instanceof FilterStep)) {
                        /*
                         * Either we are at the top level of the query, or our parent query is not a FilterStep and thus
                         * cannot handle a GremlinTypeErrorException. In any of these cases we do a binary reduction
                         * from ERROR -> FALSE and filter the solution quietly.
                         */
                    } else {
                        // not a ternary -> binary reducer, pass the ERROR on
                        throw ex;
                    }
                }
            }
        } finally {
            // close the old iterator to release resources since we are returning a new iterator (over list)
            // out of this function.
            CloseableIterator.closeIterator(iterator);
        }

        return new TinkerGraphIterator<>(list.iterator());
    }
List of iterators opened by this step.
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java