<X extends Concept> Stream<X> neighbours(Direction direction, Schema.EdgeLabel label) {
        switch (direction) {
            case BOTH:
                return vertex().getEdgesOfType(direction, label).
                        flatMap(edge -> Stream.of(
                                vertex().tx().factory().buildConcept(edge.source()),
                                vertex().tx().factory().buildConcept(edge.target()))
                        );
            case IN:
                return vertex().getEdgesOfType(direction, label).map(edge -> vertex().tx().factory().buildConcept(edge.source()));
            case OUT:
                return vertex().getEdgesOfType(direction, label).map(edge -> vertex().tx().factory().buildConcept(edge.target()));
            default:
                throw TransactionException.invalidDirection(direction);
        }
    }
< X extends Concept > Stream < X > neighbours ( Direction direction , Schema . EdgeLabel label ) { switch ( direction ) { case BOTH : return vertex ( ) . getEdgesOfType ( direction , label ) . flatMap ( edge -> Stream . of ( vertex ( ) . tx ( ) . factory ( ) . buildConcept ( edge . source ( ) ) , vertex ( ) . tx ( ) . factory ( ) . buildConcept ( edge . target ( ) ) ) ) ; case IN : return vertex ( ) . getEdgesOfType ( direction , label ) . map ( edge -> vertex ( ) . tx ( ) . factory ( ) . buildConcept ( edge . source ( ) ) ) ; case OUT : return vertex ( ) . getEdgesOfType ( direction , label ) . map ( edge -> vertex ( ) . tx ( ) . factory ( ) . buildConcept ( edge . target ( ) ) ) ; default : throw TransactionException . invalidDirection ( direction ) ; } }
@param direction the direction of the neighbouring concept to get
@param label     The edge label to traverse
@return The neighbouring concepts found by traversing edges of a specific type