Skip to content

Commit bd6d8c2

Browse files
committed
GH-2502 - Use LinkedHashSet as collection type for nodes and rels.
1 parent 5f24cad commit bd6d8c2

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;
@@ -656,7 +657,7 @@ private Collection<Node> extractMatchingNodes(Collection<Node> allNodesInResult,
656657
}
657658

658659
private Collection<Node> extractNodes(MapAccessor allValues) {
659-
Collection<Node> allNodesInResult = new ArrayList<>();
660+
Collection<Node> allNodesInResult = new LinkedHashSet<>();
660661
StreamSupport.stream(allValues.values().spliterator(), false)
661662
.filter(MappingSupport.isListContainingOnly(listType, this.nodeType))
662663
.flatMap(entry -> MappingSupport.extractNodesFromCollection(listType, entry).stream())
@@ -681,7 +682,7 @@ private Collection<Relationship> extractMatchingRelationships(Collection<Relatio
681682
}
682683

683684
private Collection<Relationship> extractRelationships(MapAccessor allValues) {
684-
Collection<Relationship> allRelationshipsInResult = new ArrayList<>();
685+
Collection<Relationship> allRelationshipsInResult = new LinkedHashSet<>();
685686
StreamSupport.stream(allValues.values().spliterator(), false)
686687
.filter(MappingSupport.isListContainingOnly(listType, this.relationshipType))
687688
.flatMap(entry -> MappingSupport.extractRelationshipsFromCollection(listType, entry).stream())

0 commit comments

Comments
 (0)