fork download
  1.  
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Map.Entry;
  7.  
  8. class Demo {
  9.  
  10. public static void main(String a[]){
  11. HashMap<String, String> hm = new HashMap<String, String>();
  12. hm.put("first", "FIRST INSERTED");
  13. hm.put("second", "SECOND INSERTED");
  14. hm.put("third","THIRD INSERTED");
  15. System.out.println(hm);
  16. Set<Entry<String, String>> entires = hm.entrySet();
  17. for(Entry<String,String> ent:entires){
  18. System.out.println(ent.getKey()+" = "+ent.getValue());
  19. }
  20. }
  21. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
{third=THIRD INSERTED, first=FIRST INSERTED, second=SECOND INSERTED}
third = THIRD INSERTED
first = FIRST INSERTED
second = SECOND INSERTED