提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从树映射中移除所有值
import java.util.TreeMap; public class Main {/**时 代 J a v a 公 众 号**/ public static void main(String[] args) { TreeMap treeMap = new TreeMap(); //add key value pairs to TreeMap treeMap.put("1","One"); treeMap.put("2","Two"); treeMap.put("3","Three"); treeMap.clear(); System.out.println("Total key value pairs in TreeMap are : " + treeMap.size()); } }/** N o w J a v a . c o m 提 供 **/