ListMultimap key ordering.

475 views
Skip to first unread message

paulo

unread,
Mar 28, 2010, 8:32:31 PM3/28/10
to guava-discuss
SortedSetMultimap specifies that the values are ordered.

What i would like myself is a SortedKeysMultimap, if you can read
that, and that the list values are not kept sorted. Basically a
priority queue+map of values, with some further prioritizing possible
manually in the list itself, to avoid starvation. Or more explicitly

SortedKeysCircularQueueMultimap.
Any such thing?

Jared Levy

unread,
Mar 28, 2010, 10:30:21 PM3/28/10
to guava-...@googlegroups.com
The following Multimaps methods let you create a multimap from a backing map and a supplier that creates Collections:
  newMultimap, newListMultimap, newSetMultimap, newSortedSetMultimap

You could pass in a TreeMap as the map and a supplier that creates PriorityQueues.

Note that resulting multimap would not expose any Queue-specific methods, but most of those methods can be simulated with Collection methods. For example, multimap.get(key).iterator().next() would return the smallest value with that key. 

--
guava-...@googlegroups.com.
http://groups.google.com/group/guava-discuss?hl=en
unsubscribe: guava-discus...@googlegroups.com

This list is for discussion; for help, post to Stack Overflow instead:
http://stackoverflow.com/questions/ask
Use the tag "guava".

To unsubscribe from this group, send email to guava-discuss+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Reply all
Reply to author
Forward
0 new messages