Skip to content

Commit

Permalink
chore(core): tiny perf improvement in MapUtils.merge()
Browse files Browse the repository at this point in the history
MapUtils.merge() un-necessary clone the map when there is only one map that is not-null and not-empty which is not needed as the map is not modified but returned immediatly.
  • Loading branch information
loicmathieu committed Jan 3, 2025
1 parent aa9af94 commit 92ff557
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/io/kestra/core/utils/MapUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public static Map<String, Object> merge(Map<String, Object> a, Map<String, Objec
}

if (a == null || a.isEmpty()) {
return copyMap(b);
return b;
}

if (b == null || b.isEmpty()) {
return copyMap(a);
return a;
}

Map copy = copyMap(a);
Expand Down

0 comments on commit 92ff557

Please sign in to comment.