Type Here to Get Search Results !

Write a javas program two find common from two map using java8

0

 public class commonfromtwomap {


public static void main(String[] args) {

Map<String,String> map1=new HashMap<>();

map1.put("nima", "eng");

map1.put("ajay", "ajau");


Map<String,String> map2=new HashMap<>();

map2.put("china", "khj");

map2.put("ajay", "ajau");


Set<Map.Entry<String,String>> coomonen=map1.entrySet();

for (Map.Entry<String, String> entry : coomonen) {

System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue());



}

}

}

Post a Comment

0 Comments

Recent-post