In Guava , we have a API work on Maps is difference, we use this API to implement the substraction operator. Create a maven proj and add below dependency to pom.xml to use this library: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>18.0</version> </dependency> Code: import java . io . IOException ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Set ; import com . google . common . collect . ImmutableMap ; import com . google . common . collect . MapDifference ; import com . google . common . collect . Maps ; public class App { public static void main ( final String [ ] args ) throws IOException { final Map < String , Integer > left = ImmutableMap . of ( "a" , 1 , "b" , 2 , "c" , 3 ) ; final Map < String , Integer > ...