提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
检查TreeMap是否存在特定值
/**from n o w j a v a . c o m - 时代Java**/ import java.util.TreeMap; public class Main { public static void main(String[] args) { TreeMap treeMap = new TreeMap(); treeMap.put("1","One"); treeMap.put("2","Two"); treeMap.put("3","Three"); boolean blnExists = treeMap.containsValue("Three"); System.out.println("Three exists in TreeMap ? : " + blnExists); } }