java中TreeSet有什么用,举例说明?

2.2 TreeSet的用法  (视频下载) (全部书籍)

TreeSet 二叉查找书,所以结果为升序,任何顺序添加打印结果都为升序。 

例:2.2.1

import java.io.*;
import java.util.*;

public class TestMark_to_win {
    public static void main(String args[]) {
        TreeSet t = new TreeSet();
        t.add("2");
        t.add("1");
        t.add("4");
        t.add("3");
/*  because the tree is binary search tree , so the result is iterator
order, so ascending order
*/
        System.out.println(t);
        t.remove("3");
        System.out.println(t);
        t.add("5");
        t.add("4");
        t.add("7");
。。。。。。。。。。。。。。。。。
详情黏贴以下网址在地址栏后请进:http://www.mark-to-win.com/index.html?content=JavaBeginner/javaUrl.html&chapter=JavaBeginner/JavaBeginner7_web.html#DefinitionUsageOfTreeSet

猜你喜欢

转载自www.cnblogs.com/mark-to-win/p/9698143.html