Reputation: 2527
im new in GUAVA, and i dont know how to get the first value in my TreeMultiMap order by a personal comparator.
I create a multitreemap like this:
TreeMultimap<String, ClassX> tm = TreeMultimap.create(Ordering.natural(), new ComparadorX();
I want to get the first value, not order by key, instead for Value. I read the Javadoc, and says that i have to use Get(Key), but i dont know how to get my first key order by value.
Thanks.
Upvotes: 0
Views: 1731
Reputation: 1502016
The TreeMultimap
itself is ordered by keys. Each entry in the map is ordered by values. It doesn't really make much sense to order the map overall by values, as each entry has multiple values... and it also reverses the normal meaning of "key" and "value", to be honest.
It's not clear what the bigger picture here is - what are you really trying to do? What data do you have? It's possible you could still use TreeMultimap
just by inverting your concept of key and value, but it's hard to say for sure without more information.
Upvotes: 3