I have two maps:
Map map1;
Map map2;
I need to receive difference between these maps. Does exist ma
Building on Vlad's example to work with maps of different sizes
public static Map mapDiff(Map extends K, ? extends V> left, Map extends K, ? extends V> right) {
Map difference = new HashMap<>();
difference.putAll(left);
difference.putAll(right);
difference.entrySet().removeAll(left.size() <= right.size() ? left.entrySet() : right.entrySet());
return difference;
}