java - Convert Map to Sorted List -
I try to convert a Suppose I have the following: ... I think? map to an ordered
list Based on the values in the
map
Maps & lt; String, integer & gt; Map = maps.newHashMap (); Map.put ("foo", 1); Map.put ("boo", 3); Map.put ("bar", 2); // List integer value - List of ASC or DESC & lt; String & gt; List = // elegant guava call? The list should be: {foo, bar, boo}
list & lt ; String & gt; List = ordering Natural (). OnResultOf (functions .map) .sortcopy (map.keySet ());
Comments
Post a Comment