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






TreeMap: size()

 

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");

    treeMap.clear();
    System.out.println(treeMap.size());
  }
}

   
  








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: subMap(K fromKey, K toKey)
12.TreeMap: tailMap(T fromKey)
13.TreeMap: values()