title: Is there a Java map implementation that returns the closest contained key
body: <p>I am looking for a Map implementation that returns the value associated with the requested key, or if not present returns the closest value, higher or lower as requested (along with the actual key, perhaps as a Map.Entry).</p>
  
  <p>For example if the Map contained the following String key/value pairs:<br>
  alpha:AYE, beta:BEE, charlie:CEE, delta:DEE<br>
  and you ask for "Next higher" for "canada" you would get back charlie:CEE</p>
  
  <p>Of course if you ask for the Next higher or Next lower for "charlie" you would get back charlie:CEE</p>
  
  <p>It should use a comparator, so that if it contains Number keys 1, 2, 3 and I request Next higher for 1.4, it would return the 2 key.</p>