利用TreeSet的排序:
HashSet hs = new HashSet(); TreeSet ts = new TreeSet(hs); ts.comparator(); System.out.println(ts);