Map: keySet() : Map : java.util : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP


Java by API  »  java.util   » [  Map  ]   
 



Map: keySet()

/*
Key Adobe; Value Mountain View, CA
Key IBM; Value White Plains, NY
Key Learning Tree; Value Los Angeles, CA
*/       
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class MainClass {

  public static void main(String[] argv) {
    Map map = new HashMap();

    map.put("Adobe""Mountain View, CA");
    map.put("IBM""White Plains, NY");
    map.put("Learning Tree""Los Angeles, CA");

    Iterator k = map.keySet().iterator();
    while (k.hasNext()) {
      String key = (Stringk.next();
      System.out.println("Key " + key + "; Value " (Stringmap.get(key));
    }
  }
}

           
       
Related examples in the same category
1.  implements Map
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.