static < T > GraphTraversal < T , Vertex > isVertex ( GraphTraversal < T , ? extends Element > traversal ) { // This cast is safe because we filter only to vertices //noinspection unchecked return ( GraphTraversal < T , Vertex > ) traversal . filter ( e -> e . get ( ) instanceof Vertex ) ; }
Create a traversal that filters to only vertices