public Iterator < AtlasEdge > getAdjacentEdgesByLabel ( AtlasVertex instanceVertex , AtlasEdgeDirection direction , final String edgeLabel ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Finding edges for {} with label {}" , string ( instanceVertex ) , edgeLabel ) ; } if ( instanceVertex != null && edgeLabel != null ) { final Iterator < AtlasEdge > iterator = instanceVertex . getEdges ( direction ) . iterator ( ) ; return new Iterator < AtlasEdge > ( ) { private AtlasEdge edge = null ; @ Override public boolean hasNext ( ) { while ( edge == null && iterator . hasNext ( ) ) { AtlasEdge localEdge = iterator . next ( ) ; if ( localEdge . getLabel ( ) . equals ( edgeLabel ) ) { edge = localEdge ; } } return edge != null ; } @ Override public AtlasEdge next ( ) { if ( hasNext ( ) ) { AtlasEdge localEdge = edge ; edge = null ; return localEdge ; } return null ; } @ Override public void remove ( ) { throw new IllegalStateException ( "Not handled" ) ; } } ; } return null ; }
So traversing all the edges