@Override
    public E projectTraverser(final Traverser.Admin<S> traverser) {
        if (this.listFold) {
            final List<S> list = new ArrayList<>();
            for (long i = 0; i < traverser.bulk(); i++) {
                list.add(traverser.get());
            }
            return (E) list;
        } else {
            return (E) traverser.get();
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/FoldStep.java