I'm trying to combine two cards
private void mergeMaps(HashMap<String, FailureExample> current, HashMap<String, FailureExample> other) { current.forEach((k, v) -> other.merge(k, v, (v1, v2) -> { FailureExample answer = new FailureExample(); addFromListWithSizeLimit(v1, answer); addFromListWithSizeLimit(v2, answer); // answer.requests.addAll(v1.requests); // answer.requests.addAll(v2.requests); return answer; })); }
but when the current has 0 elements, lambda is not executed.
Does merging happen if merging is not possible?
I want to:
map1{} ; map2{<a,<a1>>} returns map3{<a,<a1>>} map1{<a,<b1>>} ; map2{<a,<a1>>} returns map3{<a,<a1, b1>>}
source share