core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraverse.java
public List<OIdentifiable> execute() {
    final List<OIdentifiable> result = new ArrayList<OIdentifiable>();
    while (hasNext())
      result.add(next());
    return result;
  }
public List<OIdentifiable> execute() {
    final List<OIdentifiable> result = new ArrayList<OIdentifiable>();
    while (hasNext())
      result.add(next());
    return result;
  }
/*
Executes a traverse collecting all the result in the returning List<OIdentifiable>. This could be memory expensive because for
large results the list could be huge. it's always better to use it as an Iterable and lazy fetch each result on next() call.

@see com.orientechnologies.orient.core.command.OCommand#execute()