Skip to content

Commit

Permalink
Remove unneed deep copies
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <peternied@hotmail.com>
  • Loading branch information
peternied committed Mar 7, 2024
1 parent cafb776 commit d2843cf
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void handleCanUpgrade(final RestChannel channel, final RestRequest request, fina
final var differencesList = new ArrayList<ValidationResult<Tuple<CType, JsonNode>>>();
for (final var configuration : configurations) {
differencesList.add(computeDifferenceToUpdate(configuration)
.map(differences -> ValidationResult.success(new Tuple<CType, JsonNode>(configuration, differences.deepCopy()))));
.map(differences -> ValidationResult.success(new Tuple<CType, JsonNode>(configuration, differences))));
}
return ValidationResult.combine(differencesList);
}))
Expand Down Expand Up @@ -166,11 +166,11 @@ private JsonNode filterRemoveOperations(final JsonNode diff) {
final ArrayNode filteredDiff = JsonNodeFactory.instance.arrayNode();
diff.forEach(node -> {
if (!isRemoveOperation(node)) {
filteredDiff.add(node.deepCopy());
filteredDiff.add(node);
return;
} else {
if (!hasRootLevelPath(node)) {
filteredDiff.add(node.deepCopy());
filteredDiff.add(node);
}
}
});
Expand Down

0 comments on commit d2843cf

Please sign in to comment.