Since I need to get the key values of double value I' m using BiMap
.
BiMap<String,Double>mapObj = HashBiMap.create();
mapObj.put("a1",3.58654);
mapObj.put("a2",4.1567);
mapObj.put("a3",4.2546);
For a particular value like 4.0156 I must get the key value a2.. that is if,
Double value=4.0156;
mapObj.inverse().get(value)=a2
I tried many ways but its getting always null, since there is no exact match. please anyone help me... if I have chosen a wrong way please correct it because I'm new in Java.
Iterate through an Entry set like this should do the trick.
You just have to write a function to determine if the key is nearer than the previous and update the variables.