集合和数组的排序

1.数组的排序

      int[] arr=new int[]{3,2,6,4};

      Arrays.sort(arr);

2.单列集合的排序 

      List<Integer> list=new ArrayList<Integer>();

      Collections.sort(list);

      HashSet<Integer> hs=new HashSet<Integer>();

      List list2=new ArrayList(hs);

      Collections.sort(list2);

集合排序底层还是数组排序,用的无非是冒泡排序或者快速排序

3.双列集合HashMap的排序

 

posted @ 2017-06-27 18:09  海老头  阅读(340)  评论(0编辑  收藏  举报