Skip to content

Commit fd65e34

Browse files
committed
GH-2502 - Use LinkedHashSet as collection type for nodes and rels.
1 parent 582abb6 commit fd65e34

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/springframework/data/neo4j/core/mapping/DefaultNeo4jEntityConverter.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Collections;
2121
import java.util.HashMap;
2222
import java.util.HashSet;
23+
import java.util.LinkedHashSet;
2324
import java.util.List;
2425
import java.util.Map;
2526
import java.util.Optional;
@@ -671,7 +672,7 @@ private Collection<Node> extractMatchingNodes(Collection<Node> allNodesInResult,
671672
}
672673

673674
private Collection<Node> extractNodes(MapAccessor allValues) {
674-
Collection<Node> allNodesInResult = new ArrayList<>();
675+
Collection<Node> allNodesInResult = new LinkedHashSet<>();
675676
StreamSupport.stream(allValues.values().spliterator(), false)
676677
.filter(MappingSupport.isListContainingOnly(listType, this.nodeType))
677678
.flatMap(entry -> MappingSupport.extractNodesFromCollection(listType, entry).stream())
@@ -698,7 +699,7 @@ private Collection<Relationship> extractMatchingRelationships(Collection<Relatio
698699
}
699700

700701
private Collection<Relationship> extractRelationships(MapAccessor allValues) {
701-
Collection<Relationship> allRelationshipsInResult = new ArrayList<>();
702+
Collection<Relationship> allRelationshipsInResult = new LinkedHashSet<>();
702703
StreamSupport.stream(allValues.values().spliterator(), false)
703704
.filter(MappingSupport.isListContainingOnly(listType, this.relationshipType))
704705
.flatMap(entry -> MappingSupport.extractRelationshipsFromCollection(listType, entry).stream())

0 commit comments

Comments
 (0)