HashMap: values() : HashMap « java.util « Java by API






HashMap: values()

  

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Main {
  public static void main(String[] a) {
    Map<String,String> map = new HashMap<String,String>();
    map.put("key1", "value1");
    map.put("key2", "value2");
    map.put("key3", "value3");

    Collection set = map.values();
    Iterator iter = set.iterator();

    while (iter.hasNext()) {
      System.out.println(iter.next());
    }
  }
}

   
    
  








Related examples in the same category

1.new HashMap < K, V > ()
2.HashMap: clear()
3.HashMap: clone()
4.HashMap: containsKey(Object key)
5.HashMap: containsValue(Object value)
6.HashMap: entrySet()
7.HashMap: keySet()
8.HashMap: get(E o)
9.HashMap: put(E o, E o1)
10.HashMap: putAll(Map m)
11.HashMap: remove(Object key)
12.HashMap: size()