摘要:
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 阅读全文
摘要:
代码: PriorityQueue<Integer> pq = new PriorityQueue<>((x, y) -> y - x); for (int i = 1; i <= 5; i++) { pq.add(i); System.out.println( pq.toString()); } 阅读全文