摘要: int[][] arr = new int[][]{{3},{6},{5},{4},{1},{2}}; Arrays.sort(arr, (a, b) -> a[0] - b[0]); // 自定义Comparator由小到打排序 for (int i = 0; i < 6; i++) System 阅读全文
posted @ 2021-09-08 16:00 蜜铀 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 代码: PriorityQueue<Integer> pq = new PriorityQueue<>((x, y) -> y - x); for (int i = 1; i <= 5; i++) { pq.add(i); System.out.println( pq.toString()); } 阅读全文
posted @ 2021-09-08 15:41 蜜铀 阅读(158) 评论(0) 推荐(0) 编辑