摘要: 使用lambda表达式 Collections.sort(List, (a,b) -> x1 - x2); 自定义Comparator方法 Collections.sort(List, new Comparator<E>(){ public int compare(int a, int b){ re 阅读全文
posted @ 2021-07-03 20:43 acchris 阅读(55) 评论(0) 推荐(0)
摘要: Collection接口 方法 boolean add(E obj) boolean addAll(Collection c) void clear() boolean isEmpty() Iterator iterator() boolean remove(Object obj) int size 阅读全文
posted @ 2021-07-03 20:27 acchris 阅读(48) 评论(0) 推荐(0)
摘要: TreeMap 与哈希表HashMap的区别: 有序表组织key,哈希表完全不组织。 **TreeMap关键点:**放入有序表中的元素,若不是基本类型,必须要有比较器,才能使其内部有序。 基本方法 Comparator<K> com = new Comparator<Integer>(){ @Ove 阅读全文
posted @ 2021-07-03 00:29 acchris 阅读(74) 评论(0) 推荐(0)