I have two maps:
Map map1;
Map map2;
I need to receive difference between these maps. Does exist ma
Here is a simple snippet you can use instead of massive Guava library:
public static Map mapDifference(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(right.entrySet());
return difference;
}
Check out the whole working example