How to receive difference of maps in java?
How about google guava?:
Maps.difference(map1,map2)
Here is a simple snippet you can use instead of massive Guava library:
public static <K, V> Map<K, V> mapDifference(Map<? extends K, ? extends V> left, Map<? extends K, ? extends V> right) {
Map<K, V> difference = new HashMap<>();
difference.putAll(left);
difference.putAll(right);
difference.entrySet().removeAll(right.entrySet());
return difference;
}
Check out the whole working example