57. Collections(list的工具类)、Arrays(数组的工具类)

List集合的工具类(Collections):  

  注意:Collection是单列集合的根接口  Collections是操作集合对象的工具类

 

  1.对list集合排序:

    sort(List)    根据自然特性排序

    sort(List,Comaprator)  根据比较器排序

  

  2.对集合list进行二分查找:

    int  binarySearch(List,key)

    int  binarySearch(List,key,Comaprator)

  

  3.对集合取最大最小值:

    max(Collection)

    max(Collection,Comapartor)

    min(Collection)

    min(Collection,Comapartor)

 

Array的工具类(Arrays):

  1.复制数组:

    copyOf()

  2.复制部分数组:

    copyOfRange()

  3.比较两个数组是否相等

    equals(int[],int[])

  4.将数组变成集合

    asList(T[])

   

    

posted @ 2018-05-08 19:11  江小白鞋  阅读(128)  评论(0编辑  收藏  举报