[concurrency-interest] Double as a key in TreeMap
aleksey.shipilev at gmail.com
Thu May 31 16:20:51 EDT 2012
On 06/01/2012 12:01 AM, George Kovoor wrote:
> Could anyone please advise if using Double as a key in TreeMap is
> safe, safe in the sense will it result in consistent output.
> I am worried about the floating point precision, that might result in
> key misses , is my understanding correct. Is using Double recommend in
> Any feedback is very much appreciated
These are generally the horrible ideas of the same class: asking the
offtopic question on the mailing list, and using floating point values
as the map keys. Doing that to order keys-value pairs is more or less
fine, but good luck get the desired element with explicit get(Double d).
More information about the Concurrency-interest