英文:
How to add values to priority queue(reverse order) used as a value in HashMap
问题
如何将值添加到作为HashMap中值使用的优先队列(倒序)
我知道如何声明一个倒序的优先队列,就像下面这样:
PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
我知道如何将优先队列声明为HashMap中的值,就像下面这样:
Map<Integer, PriorityQueue<Integer>> map = new HashMap<>();
我想知道,在Java中,我是否可以将倒序的优先队列声明为HashMap中的值?
英文:
How to add values to priority queue(reverse order) used as a value in HashMap
I know how to declare a priority in a reverse order using, like below
PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
I know how to declare priority queue as a value in a hashmap, like below
Map<Integer,PriorityQueue<Integer>> map = new HashMap<>();
I would like to know, can I declare priority queue in reverseOrder as a value in hashmap in java?
专注分享java语言的经验与见解,让所有开发者获益!
评论