Skip to content

Commit

Permalink
CDR-1421 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HolgerReiseVSys committed Nov 5, 2024
1 parent 69df6d4 commit 2b92d3b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public static List<WebTemplateNode> getTrueChildrenElement(WebTemplateNode node)

public static <T> List<T> cloneList(List<T> list, UnaryOperator<T> elementCloner) {
List<T> clonedList = new ArrayList<>(list.size());
list.forEach(el -> clonedList.add(elementCloner.apply(el)));
for (T el : list) {
clonedList.add(elementCloner.apply(el));
}
return clonedList;
}

Expand All @@ -81,7 +83,9 @@ public static <K, V> LinkedHashMap<K, V> cloneMap(Map<K, V> map, UnaryOperator<V
return new LinkedHashMap<>();
}
LinkedHashMap<K, V> newMap = new LinkedHashMap<>((map.size() * 4 / 3) + 1, 0.75f);
map.forEach((k, v) -> newMap.put(k, valueCloner.apply(v)));
for (Map.Entry<K, V> entry : map.entrySet()) {
newMap.put(entry.getKey(), valueCloner.apply(entry.getValue()));
}
return newMap;
}
}

0 comments on commit 2b92d3b

Please sign in to comment.