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 convert Sequence to ResourceIterable.
I am trying to fetch all relationships from the end node and apply two additional filters on top it using Sequence (com.googlecode.totallylazy) and return the Iterable.
However, with Neo4j 5.20, "expand" method of PathExpander returns ResourceIterable.
Either I need to add filters for ResourceIterable without using Sequence or I need to convert Sequence to ResourceIterable.
Can you please guide if there are any solutions available for either of the above options?
Existing code in Neo4j 2.3.8:
<
private static PathExpander overlappingRuns(final RunsCriteria criteria) {
return new PathExpander() {
@Override
public Iterable expand(Path path, BranchState state) {
return sequence(path.endNode().getRelationships())
.filter(relationships(StopsAt.class))
.filter(overlapping(criteria));
}
@Override
public PathExpander<Integer> reverse() {
return this;
}
};
}
/>
Upgrading to Neo4j 5.2x: I have tried this way but its giving error "Type mismatch: cannot convert from Sequence to ResourceIterableJava(16777235)"
<
private static PathExpander overlappingRuns(final RunsCriteria criteria) {
return new PathExpander() {
@Override
public ResourceIterable expand(Path path, BranchState state) {
return sequence(path.endNode().getRelationships())
.filter(relationships(StopsAt.class))
.filter(overlapping(criteria));
}
@Override
public PathExpander<Integer> reverse() {
return this;
}
};
}
/>