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






TreeMap: values()

 
import java.util.Collection;
import java.util.Iterator;
import java.util.TreeMap;

public class Main {
  public static void main(String[] args) {
    TreeMap<String, String> treeMap = new TreeMap<String,String>();
    treeMap.put("1", "One");
    treeMap.put("2", "Two");
    treeMap.put("3", "Three");

    Collection c = treeMap.values();
    Iterator itr = c.iterator();

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

   
  








Related examples in the same category

1.new TreeMap < K, V > ()
2.TreeMap: entrySet()
3.TreeMap: firstKey()
4.TreeMap: get(K k)
5.TreeMap: headMap(K toKey)
6.TreeMap: headMap(K toKey, boolean inclusive)
7.TreeMap: higherKey(K key)
8.TreeMap: lastKey()
9.TreeMap: lowerKey(K key)
10.TreeMap: put(K k, V v)
11.TreeMap: size()
12.TreeMap: subMap(K fromKey, K toKey)
13.TreeMap: tailMap(T fromKey)