嵌套 PriorityQueue 时在构造函数中实现比较器

问题描述 投票:0回答:0

我想制作一个 ArrayList of PriorityQueue of Integer[] ( ArrayList> ) 但我无法在构造函数区域中实现比较器。

ArrayList<PriorityQueue<Integer[]>> p = new ArrayList<>((o1,o2) -> o1[2] - o2[2]);

我试图制作一个包含基于整数数组第三个索引的整数数组的 PriorityQueue 数组列表。 enter image description here

java comparator priority-queue
© www.soinside.com 2019 - 2024. All rights reserved.