The entrySet() method of the Map returns a set which elements are the Map.Entry Object.
Example:
import java.util.*;
class demo1
{
public static void main(String[] args){
HashMap
hm.put(4,"bhabani");
hm.put(1,"samar");
hm.put(8,"gaura");
hm.put(3,"milan");
Set
for(Map.Entry
System.out.print(me.getKey()+":");
System.out.println(me.getValue()+":");
//System.out.println(me);//Alternative way to display
}}};
No comments:
Post a Comment