提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
获取Java树集的大小
import java.util.TreeSet; public class Main {/* 来自 nowjava*/ public static void main(String[] args) { TreeSet tSet = new TreeSet(); System.out.println("Size of TreeSet : " + tSet.size()); //add elements to TreeSet object tSet.add(new Integer("1")); tSet.add(new Integer("2")); tSet.add(new Integer("3")); System.out.println("Size of TreeSet after addition : " + tSet.size()); //remove one element from TreeSet using remove method tSet.remove(new