Is there an implementation of type SortedMultimap in Guava that does not care about the order of its values

eg. I want the multimap from Integer to be zero or more File objects. I would like the map to remain sorted when I insert or delete entries. But I do not care about the order of the values ​​(Files), which in any case do not have a natural order.

It seems that there is no implementation that I see (which is very bad), so right now I'm stuck with TreeMap<Integer, List<File>>.

+4
source share
1 answer

MultimapBuilder should be able to do what you want:

SetMultimap<Integer, File> multimap =
    MultimapBuilder.treeKeys().hashSetValues().build();
+4
source

Source: https://habr.com/ru/post/1529731/


All Articles