Assume that I have a HashMap, where the value is of type PriorityQueue like:
HashMap<Integer, PriorityQueue<Integer>> someMap = new HashMap<>();
But how do I initialize this HashMap, if I need the PriorityQueue to have a custom comparator?
The actual comparator is much more complex, But for simplicity let's assume that I need the PriorityQueue to sort by reverse order, which I can do by:
PriorityQueue<Integer> queue = new PriorityQueue<>(Comparator.reverseOrder());
Where and How should I define the comparator for the value in HashMap?