开发者

TreeMultimap in Google Collections

Has anybody used TreeMultimap in Google Collections? I understand that with a TreeMultimap, its keys and values are ordered by their natural ordering or by supplied comparators. I was wondering if there开发者_Python百科 is a function that allows user to supply a key and returns all the values whose keys are greater than the user-supplied key. This can be done with a SortedMap in Java which has a function called tailMap. Thanks!


I haven't used the TreeMultiMap class but a quick look at the Javadoc would suggest that you could use the asMap() method to get a SortedMap and then call tailMap() on that.


Yeah, I made TreeMultimap.asMap() return a SortedMap to support cases like this.

Remember that tailMap() returns all entries whose keys are greater than or equal to the provided key. The original question said just "greater than".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜