提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从树集中删除指定元素
/** from N o w J a v a . c o m - 时 代 Java**/ import java.util.TreeSet; public class Main { public static void main(String[] args) { //create object of TreeSet TreeSet tSet = new TreeSet(); //add elements to TreeSet object tSet.add(new Integer("1")); tSet.add(new Integer("2")); tSet.add(new Integer("3")); System.out.println("TreeSet before removal : " + tSet); boolean blnRemoved = tSet.remove(new Integer("2")); System.out.println(