Collections and DBConnections and Grid
HashMap: public class CollectionsHashMap { public static void main(String[] args) { // TODO Auto-generated method stub HashMap hs = new HashMap (); HashMap hsNew = new HashMap (); hs.put(3, "Gaddam"); hs.put(1, "Santosh"); hs.put(2, "kumar"); System.out.println(hs); System.out.println("==="); hs.remove(2); System.out.println(hs); System.out.println("==="); hs.put(3, "Gaddams"); hs.put(4, ""); hs.put(5, ""); hs.put(null, "its me null key"); hs.put(null, "its me null keys"); System.out.println(hs); Set hp = hs.entrySet(); Iterator ip = hp.iterator(); while(ip.hasNext()) { Map.Entry mp = (Map.Entry)ip.next(); System.out.println(mp.getKey() + " " +mp.getValue()); } // practise purpose HashMap hm = new HashMap (); hm.put(1, "Selenium"); hm.put(2, "QTP"); ...




Comments
Post a Comment