Reputation: 1736
E.g. I want a multimap from Integer to zero or more File objects. I'd like the map to stay sorted as I insert or remove entries. But I don't care about the order of the values (Files), which don't have a natural ordering anyway.
There doesn't seem to be an implementation that I can see (which is really unfortunate), so right now I'm stuck using TreeMap<Integer, List<File>>
.
Upvotes: 4
Views: 370
Reputation: 60967
MultimapBuilder
should be able to do what you want:
SetMultimap<Integer, File> multimap =
MultimapBuilder.treeKeys().hashSetValues().build();
Upvotes: 4