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






Map: 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.implements Map
2.java.util.Map.Entry
3.Map: clear()
4.Map: containsKey(Object key)
5.Map: containsValue(Object value)
6.Map: equals(Object o)
7.Map: get(Object key)
8.Map.Entry: getKey()
9.Map.Entry: getValue()
10.Map: keySet()
11.Map: put(T key, T value)
12.Map: putAll(Map m)
13.Map: remove(Object key)
14.Map: size()