【集合工具類:Collections】

 
集合工具類:Collections
(1) 是針對集合進行操做的工具類
(2) 面試題:Collection  Collections 的區別
A:Collection 是單列集合的頂層接口,有兩個子接口 List Set
B:Collections 是針對集合進行操做的工具類,能夠對集合進行排序和查找等
(3) 常見的幾個小方法:
A:public static <T> void sort(List<T> list)
B:public static <T> int binarySearch(List<?> list,T key)
C:public static <T> T max(Collection<?> coll)
D:public static void reverse(List<?> list) E:public static void shuffle(List<?> list)
(4) 案例
A:ArrayList 集合存儲自定義對象的排序
B: 模擬鬥地主洗牌和發牌
C: 模擬鬥地主洗牌和發牌並對牌進行排序
相關文章
相關標籤/搜索