Java's priority queue is a data structure with O(log n)
complexity for put (insertion) and O(log n)
for poll (retrieval and removal of the min element).
C++ STL's multimap has the same functionality but O(1)
complexity for retrieval and removal of the min element (begin and erase). Is there an equivalent in Java ?
Google Collections provides a Multimap implementation. Specifically, a TreeMultimap can use comparators to sort based on either keys, values or both.