@Override
  public Iterable<Vertex> getVertices(final Direction iDirection, final String... iLabels) {
    setCurrentGraphInThreadLocal();

    OrientBaseGraph.getEdgeClassNames(getGraph(), iLabels);
    OrientBaseGraph.encodeClassNames(iLabels);

    final ODocument doc = getRecord();

    final OMultiCollectionIterator<Vertex> iterable = new OMultiCollectionIterator<Vertex>();

    for (OTriple<String, Direction, String> connectionField : getConnectionFields(iDirection, iLabels)) {
      String fieldName = connectionField.getKey();
      OPair<Direction, String> connection = connectionField.getValue();

      final Object fieldValue = doc.rawField(fieldName);
      if (fieldValue != null)
        if (fieldValue instanceof OIdentifiable) {
          addSingleVertex(doc, iterable, fieldName, connection, fieldValue, iLabels);

        } else if (fieldValue instanceof Collection<?>) {
          Collection<?> coll = (Collection<?>) fieldValue;

          if (coll.size() == 1) {
            // SINGLE ITEM: AVOID CALLING ITERATOR
            if (coll instanceof ORecordLazyMultiValue)
              addSingleVertex(doc, iterable, fieldName, connection, ((ORecordLazyMultiValue) coll).rawIterator().next(), iLabels);
            else if (coll instanceof List<?>)
              addSingleVertex(doc, iterable, fieldName, connection, ((List<?>) coll).get(0), iLabels);
            else
              addSingleVertex(doc, iterable, fieldName, connection, coll.iterator().next(), iLabels);
          } else {
            // CREATE LAZY Iterable AGAINST COLLECTION FIELD
            if (coll instanceof ORecordLazyMultiValue)
              iterable.add(new OrientVertexIterator(this, coll, ((ORecordLazyMultiValue) coll).rawIterator(), connection, iLabels,
                  coll.size()));
            else
              iterable.add(new OrientVertexIterator(this, coll, coll.iterator(), connection, iLabels, -1));
          }
        } else if (fieldValue instanceof ORidBag) {
          iterable.add(new OrientVertexIterator(this, fieldValue, ((ORidBag) fieldValue).rawIterator(), connection, iLabels, -1));
        }
    }

    return iterable;
  }
@ Override public Iterable < Vertex > getVertices ( final Direction iDirection , final String ... iLabels ) { setCurrentGraphInThreadLocal ( ) ; OrientBaseGraph . getEdgeClassNames ( getGraph ( ) , iLabels ) ; OrientBaseGraph . encodeClassNames ( iLabels ) ; final ODocument doc = getRecord ( ) ; final OMultiCollectionIterator < Vertex > iterable = new OMultiCollectionIterator < Vertex > ( ) ; for ( OTriple < String , Direction , String > connectionField : getConnectionFields ( iDirection , iLabels ) ) { String fieldName = connectionField . getKey ( ) ; OPair < Direction , String > connection = connectionField . getValue ( ) ; final Object fieldValue = doc . rawField ( fieldName ) ; if ( fieldValue != null ) if ( fieldValue instanceof OIdentifiable ) { addSingleVertex ( doc , iterable , fieldName , connection , fieldValue , iLabels ) ; } else if ( fieldValue instanceof Collection < ? > ) { Collection < ? > coll = ( Collection < ? > ) fieldValue ; if ( coll . size ( ) == 1 ) { if ( coll instanceof ORecordLazyMultiValue ) addSingleVertex ( doc , iterable , fieldName , connection , ( ( ORecordLazyMultiValue ) coll ) . rawIterator ( ) . next ( ) , iLabels ) ; else if ( coll instanceof List < ? > ) addSingleVertex ( doc , iterable , fieldName , connection , ( ( List < ? > ) coll ) . get ( 0 ) , iLabels ) ; else addSingleVertex ( doc , iterable , fieldName , connection , coll . iterator ( ) . next ( ) , iLabels ) ; } else { if ( coll instanceof ORecordLazyMultiValue ) iterable . add ( new OrientVertexIterator ( this , coll , ( ( ORecordLazyMultiValue ) coll ) . rawIterator ( ) , connection , iLabels , coll . size ( ) ) ) ; else iterable . add ( new OrientVertexIterator ( this , coll , coll . iterator ( ) , connection , iLabels , - 1 ) ) ; } } else if ( fieldValue instanceof ORidBag ) { iterable . add ( new OrientVertexIterator ( this , fieldValue , ( ( ORidBag ) fieldValue ) . rawIterator ( ) , connection , iLabels , - 1 ) ) ; } } return iterable ; }
Returns a lazy iterable instance against vertices.

@param iDirection The direction between OUT, IN or BOTH
@param iLabels    Optional varargs of Strings representing edge label to consider