I am creating a *Min-Heap* using `PriorityQueue` populated from a `HashMap`. Where `Entry` objects of the `Map` are pairs of `Integer` & `Integer`.

And I'm implementing it with a help of `Comparator`. To use *Value* of `HashMap` for comparison.

My question is - How to make comparison of `HashMap` entries on *Value* of type `Integer`?

```
PriorityQueue<Map.Entry<Integer, Integer>> minHeap = new PriorityQueue<>(new Comparator<Map.Entry<Integer, Integer>>() {
    @Override
    public int compare(Entry<Integer, Integer> o1, Entry<Integer, Integer> o2) {
        return o1.getValue() - o2.getValue();
    }
});

```