// Path: driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/StreamUtils.java
// public static <T> Stream<T> asStream(Iterator<T> sourceIterator) {
//   return asStream(sourceIterator, false);
// }


import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.apache.tinkerpop.gremlin.orientdb.StreamUtils.asStream;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.record.OEdge;
import com.orientechnologies.orient.core.record.OVertex;
import com.orientechnologies.orient.core.record.impl.ODocument;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.tinkerpop.gremlin.structure.*;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
package org.apache.tinkerpop.gremlin.orientdb;



public final class OrientVertex extends OrientElement implements Vertex {

  private static final List<String> INTERNAL_FIELDS = Arrays.asList("@rid", "@class");

  public OrientVertex(final OGraph graph, final OVertex rawElement) {
    super(graph, rawElement);
  }

  public OrientVertex(OGraph graph, OIdentifiable identifiable) {
    this(
        graph,
        new ODocument(identifiable.getIdentity())
            .asVertex()
            .orElseThrow(
                () ->
                    new IllegalArgumentException(
                        String.format("Cannot get a Vertex for identity %s", identifiable))));
  }

  public OrientVertex(OGraph graph, String label) {
    this(graph, createRawElement(graph, label));
  }

  protected static OVertex createRawElement(OGraph graph, String label) {
    graph.createVertexClass(label);
    return graph.getRawDatabase().newVertex(label);
  }

  public Iterator<Vertex> vertices(final Direction direction, final String... labels) {
    this.graph.tx().readWrite();
    Stream<Vertex> vertexStream =
// Path: driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/StreamUtils.java
// public static <T> Stream<T> asStream(Iterator<T> sourceIterator) {
//   return asStream(sourceIterator, false);
// }


// Path: driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/OrientVertex.java
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.apache.tinkerpop.gremlin.orientdb.StreamUtils.asStream;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.record.OEdge;
import com.orientechnologies.orient.core.record.OVertex;
import com.orientechnologies.orient.core.record.impl.ODocument;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.tinkerpop.gremlin.structure.*;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;

package org.apache.tinkerpop.gremlin.orientdb;



public final class OrientVertex extends OrientElement implements Vertex {

  private static final List<String> INTERNAL_FIELDS = Arrays.asList("@rid", "@class");

  public OrientVertex(final OGraph graph, final OVertex rawElement) {
    super(graph, rawElement);
  }

  public OrientVertex(OGraph graph, OIdentifiable identifiable) {
    this(
        graph,
        new ODocument(identifiable.getIdentity())
            .asVertex()
            .orElseThrow(
                () ->
                    new IllegalArgumentException(
                        String.format("Cannot get a Vertex for identity %s", identifiable))));
  }

  public OrientVertex(OGraph graph, String label) {
    this(graph, createRawElement(graph, label));
  }

  protected static OVertex createRawElement(OGraph graph, String label) {
    graph.createVertexClass(label);
    return graph.getRawDatabase().newVertex(label);
  }

  public Iterator<Vertex> vertices(final Direction direction, final String... labels) {
    this.graph.tx().readWrite();
    Stream<Vertex> vertexStream =
        asStream(