Skip to content

Commit

Permalink
feat: adjust array merge logic to avoid duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
CarstenWickner committed Dec 9, 2024
1 parent 3efd7d5 commit 6492b14
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ private Supplier<JsonNode> mergeArrays(List<JsonNode> arrayNodesToMerge) {
return null;
}
return () -> {
Set<JsonNode> arrayItems = new LinkedHashSet<>();
arrayNodesToMerge.forEach(node -> node.forEach(arrayItems::add));

ArrayNode mergedArrayNode = this.config.createArrayNode();
arrayNodesToMerge.forEach(node -> node.forEach(mergedArrayNode::add));
arrayItems.forEach(mergedArrayNode::add);
return mergedArrayNode;
};
}
Expand Down

0 comments on commit 6492b14

Please sign in to comment.