提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
获取树映射的大小
import java.util.TreeMap; /* *来 自 nowjava.com - 时代Java */ public class Main { public static void main(String[] args) { TreeMap treeMap = new TreeMap(); System.out.println("Size of TreeMap : " + treeMap.size()); //add key value pairs to TreeMap using put method treeMap.put("1","One"); treeMap.put("2","Two"); treeMap.put("3","Three"); System.out.println("Size of TreeMap after addition : " + treeMap.size()); /* 时 代 Java 公 众 号 - nowjava.com 提供 */