after I create a new object : Map<Float,Integer> m = new HashMap()<Float,Integer>;
I have an array with "float" numbers which are unique . I want to add these float numbers as the m's key! can I do this like : m.put(new Float(a[i]),"cat"); ?
thanks
I would recommend against using floating point numbers as hash map keys if possible. Your keys must match exactly when you look up values, and it’s easy to get floating point numbers that aren’t exactly right.