3434import org .neo4j .token .TokenHolders ;
3535
3636import java .util .Arrays ;
37+ import java .util .List ;
3738
3839public abstract class InMemoryRelationshipCursor extends RelationshipRecord implements RelationshipVisitor <RuntimeException >, StorageRelationshipCursor {
3940
4041 protected final CypherGraphStore graphStore ;
4142 protected final TokenHolders tokenHolders ;
42- private final RelationshipIds .RelationshipIdContext [] relationshipIdContexts ;
43+ private final List < RelationshipIds .RelationshipIdContext > relationshipIdContexts ;
4344 private final AdjacencyCursor [] adjacencyCursorCache ;
4445 private final PropertyCursor [][] propertyCursorCache ;
4546
@@ -59,11 +60,11 @@ public InMemoryRelationshipCursor(CypherGraphStore graphStore, TokenHolders toke
5960 this .graphStore = graphStore ;
6061 this .tokenHolders = tokenHolders ;
6162 this .relationshipIdContexts = this .graphStore .relationshipIds ().relationshipIdContexts ();
62- this .adjacencyCursorCache = Arrays .stream (relationshipIdContexts )
63+ this .adjacencyCursorCache = relationshipIdContexts .stream ()
6364 .map (context -> context .adjacencyList ().rawAdjacencyCursor ())
6465 .toArray (AdjacencyCursor []::new );
6566
66- this .propertyCursorCache = Arrays .stream (relationshipIdContexts )
67+ this .propertyCursorCache = relationshipIdContexts .stream ()
6768 .map (context -> Arrays
6869 .stream (context .adjacencyProperties ())
6970 .map (AdjacencyProperties ::rawPropertyCursor )
@@ -96,7 +97,7 @@ public long targetNodeReference() {
9697
9798 @ Override
9899 public boolean hasProperties () {
99- return relationshipIdContexts [ relationshipContextIndex ] .graph ().hasRelationshipProperty ();
100+ return relationshipIdContexts . get ( relationshipContextIndex ) .graph ().hasRelationshipProperty ();
100101 }
101102
102103 @ Override
@@ -160,15 +161,15 @@ public void properties(StoragePropertyCursor propertyCursor, InMemoryPropertySel
160161 private boolean progressToNextContext () {
161162 relationshipContextIndex ++;
162163
163- if (relationshipContextIndex >= relationshipIdContexts .length ) {
164+ if (relationshipContextIndex >= relationshipIdContexts .size () ) {
164165 return false ;
165166 }
166167
167168 if (relationshipContextIndex > 0 ) {
168- relationshipTypeOffset += relationshipIdContexts [ relationshipContextIndex - 1 ] .relationshipCount ();
169+ relationshipTypeOffset += relationshipIdContexts . get ( relationshipContextIndex - 1 ) .relationshipCount ();
169170 }
170171
171- var context = relationshipIdContexts [ relationshipContextIndex ] ;
172+ var context = relationshipIdContexts . get ( relationshipContextIndex ) ;
172173
173174 if (!selection .test (context .relationshipTypeId ())) {
174175 return progressToNextContext ();
0 commit comments