Hi I have a HashMap
and also a function which returns a double value known as answer
. I want to check which value in the Hash
The concept of 'closest' is not really meaningful for Hashed data structures. The primary goal of efficient hashing algorithms is collision avoidance, which is directly contrary to closeness. Either you have a collision, or not.
If you were asking this for an ordered key data structure (eg. TreeMap
), the answer would be different.