Skip to content

Commit 2186ade

Browse files
committed
GH-2502 - Use LinkedHashSet as collection type for nodes and rels.
1 parent 7a46cac commit 2186ade

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;
@@ -676,7 +677,7 @@ private Collection<Node> extractMatchingNodes(Collection<Node> allNodesInResult,
676677
}
677678

678679
private Collection<Node> extractNodes(MapAccessor allValues) {
679-
Collection<Node> allNodesInResult = new ArrayList<>();
680+
Collection<Node> allNodesInResult = new LinkedHashSet<>();
680681
StreamSupport.stream(allValues.values().spliterator(), false)
681682
.filter(MappingSupport.isListContainingOnly(listType, this.nodeType))
682683
.flatMap(entry -> MappingSupport.extractNodesFromCollection(listType, entry).stream())
@@ -703,7 +704,7 @@ private Collection<Relationship> extractMatchingRelationships(Collection<Relatio
703704
}
704705

705706
private Collection<Relationship> extractRelationships(MapAccessor allValues) {
706-
Collection<Relationship> allRelationshipsInResult = new ArrayList<>();
707+
Collection<Relationship> allRelationshipsInResult = new LinkedHashSet<>();
707708
StreamSupport.stream(allValues.values().spliterator(), false)
708709
.filter(MappingSupport.isListContainingOnly(listType, this.relationshipType))
709710
.flatMap(entry -> MappingSupport.extractRelationshipsFromCollection(listType, entry).stream())

0 commit comments

Comments
 (0)