Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java HashMap find best matching key

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?

like image 283
Andreas Linden Avatar asked Sep 05 '26 13:09

Andreas Linden


1 Answers

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

like image 112
Jesper Avatar answered Sep 08 '26 03:09

Jesper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!