for (Entry entry : map.entrySet()) {
Double key = entry.getKey();
String value = entry.getValue();
// double nextKe
A TreeMap is an OrderedMap and a NavigableMap and will allow you to iterate forward and backward, allowing you to access previous and next keys with lowerKey() and higherKey() respectively. However it might not be the best solution.
Can you describe the actual problem you're trying to solve, and we can give you a more fitting solution?