Extract Nodes from Result

I am migrating from Neo4j 2.3.8 (embedded) to 5.20 for one of my java applications.
Can you please guide me how to extract Nodes (org.neo4j.graphdb.Node) from Result (org.neo4j.graphdb.Result). I am trying to fetch all nodes that are matching with the destination stop name. I need to convert Result to Nodes so that they can be filtered using "sequence.map (com.googlecode.totallylazy.Sequence)" as shown in the code. Can you please help.

Existing code in Neo4j 2.3.8:

/*
public RelatedTripEvaluator(Index index, StopName destinationStop, Neo4j neo,
Option... viaStopNames) {
this.destinationStop = destinationStop;
this.viaStops = viaStopNames;
this.index = index;
this.neo = neo;
/*
* CODE CHANGE: After upgrade to neo4j2.3.8, Transaction Handling implemented
*/
Transaction tx = neo.beginTx();
try {
this.endNodes = sequence(index.query(nodeStopNameExactMatchQuery(destinationStop)))
.map(toLowerCaseNodeName()).realise();

		if (viaStopNames == null) {
			this.viaStops = new Option[] {};
		}
	} catch (Exception ex) {
		throw ex;

	} finally {

		successAndFinish(tx);
	}

public static Query nodeStopNameExactMatchQuery(StopName stopName) {
return new TermQuery(new Term(GraphNode.LONG_NAME.name(), stopName.value()));
}

public static Sequence sequence(final Iterable<? extends T> iterable) {
if (iterable == null) return empty();

    if (iterable instanceof Sequence) return cast(iterable);

    return new Sequence<T>() {
        public final Iterator<T> iterator() {
            return cast(iterable.iterator());
        }
    };
}

*/

Upgrading to Neo4j 5.2x: I have tried this way but not sure if I have done it right. Please validate and confirm.

/*
@SuppressWarnings("unchecked")
public RelatedTripEvaluator(StopName destinationStop, Neo4j neo,
Option... viaStopNames) {
this.destinationStop = destinationStop;
this.viaStops = viaStopNames;
this.neo = neo;
/*
* CODE CHANGE: After upgrade to neo4j2.3.8, Transaction Handling implemented
*/
Transaction tx = neo.beginTx();
try {

        List<Node> node= new ArrayList<Node>();

        Result result = tx.execute(nodeStopNameExactMatchQuery(destinationStop).toString());
        if (result.hasNext()) {
            node.add((Node)result.next());
        }

        this.endNodes = sequence(node)
                .map(toLowerCaseNodeName()).realise();

        if (viaStopNames == null) {
            this.viaStops = new Option[]{};
        }
    } catch (Exception ex) {
        throw ex;

    } finally {

        successAndFinish(tx);
    }
}

*/