Entry interface is innner interface of Map interface
Entry is key + value .
public class Outer {
public static void main(String args[]) {
Map<String,Integer> mp = new LinkedHashMap<>();
Entry<String,Integer> e = entry("sato-a",100);
Entry<String,Integer> e1 = entry("sato-b",101);
Entry<String,Integer> e2 = entry("sato-c",102);
mp = Map.ofEntries(e,e1,e2);
Set<Entry<String,Integer>> s = mp.entrySet();
mp.entrySet().forEach((Entry<String,Integer> x) -> System.out.println(x.getKey() + ":" + x.getValue()));
System.out.println("--------------------");
for(Entry<String,Integer> en:s) {
System.out.println(en.getKey() + ":" + en.getValue());
}
}
}
sato-a:100
sato-b:101
sato-c:102
--------------------
sato-a:100
sato-b:101
sato-c:102