Created
January 7, 2017 09:40
-
-
Save baladkb/26380ca7b0cbd56a02d4c19ebb13d3a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
public class HASMAPCompare { | |
public static void main(String[] args) { | |
final Map<String, String> hm1 = new HashMap<String, String>(); | |
hm1.put("01", "Bala"); | |
hm1.put("02", "Sha"); | |
hm1.put("03", "Sha"); | |
final Map<String, String> hm2 = new HashMap<String, String>(); | |
hm2.put("01", "Bala"); | |
hm2.put("02", "Sha0"); | |
final Map<String, String> hm3 = new HashMap<String, String>(); | |
for (final String key : hm1.keySet()) { | |
if (hm2.containsValue(hm1.get(key))) { | |
hm3.put(hm1.get(key), hm2.get(key)); | |
} | |
} | |
System.out.println(hm3.size()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment