首页 > 编程语言 > 详细

为set集合排序

时间:2020-06-18 16:00:27      阅读:73      评论:0      收藏:0      [点我收藏+]

public static void main(String[] args) {
  HashSet<String> has = new HashSet<String>();
  has.add("");
  has.add("1");
  has.add("0");
  has.add("3");
  has.add("2");
  has.add("2");
  has.add("4");
  System.out.println(has);
  TreeSet<String> tree = new TreeSet<String>(has);
  tree.comparator();
  System.out.println(tree);
}

输出为

技术分享图片

 

为set集合排序

原文:https://www.cnblogs.com/wangjianl/p/13157953.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!