Java HashMap find best matching key

floating-point, hashmap, java

Solution

Sounds like a job for one of the implementations of `java.util.NavigableMap`.

Problem

I have a Java HashMap with Float keys and String values. now given a Float which is not in the HashMap, how can i find the key which ist most similar to the given Float?

Original source