I need to implement Priority Queue using MultiMap. I am using MultiMap from Google Collections. The following code creates a MultiMap and adds several elements to it.
Multimap<Integer, String> multimap = HashMultimap.create(); multimap.put(5,"example"); multimap.put(1,"is"); multimap.put(1,"this"); multimap.put(4,"some");
Now my problem is how to write a pop method?
I think there should be a for loop and it should be repeated through MultiMap.
The lowest key should be the highest priority, so in C ++ I would set the pointer to the first element and increment it. How to do it in Java?
java multimap guava priority-queue
Devel
source share