I have a LinkedHashMap<String, String>
, which contains some pre-populated data. Now I have a String
value, which will match to a key in the above LinkedHashMap
. What can I do to retrieve the very next key of the above match?
Example:
LinkedHashMap hm = new LinkedHashMap();
hm.put("a",1);
hm.put("b",2);
hm.put("c",3);
hm.put("d",4);
hm.put("e",5);
Now I have a String
, say "d" . What is the optimal way if I have to retrieve the value of "e" from the above Map
?
One way I have found is to convert the map key into LinkedHashSet
. Now iterate the Set
. Compare the value and get the next value. But isn't there any API available, which can get me all this?