TreeMultimap in Google Collections

Has anyone used TreeMultimap in Google Collections? I understand that using TreeMultimap, its keys and values ​​are ordered by their natural order or by the provided comparators. I was wondering if there is a function that allows the user to provide a key and returns all values ​​whose keys are larger than the key provided by the user. This can be done using SortedMap in Java, which has a feature called tailMap. Thanks!

+4
source share
2 answers

I did not use the TreeMultiMap class, but a quick look at Javadoc suggests that you can use the asMap () method to get a SortedMap, and then call the tailMap () function.

+11
source

Yes, I did TreeMultimap.asMap () returned SortedMap to support such cases.

Remember that tailMap () returns all records whose keys are greater than or equal to the provided key. The initial question said simply "more."

+2
source

All Articles