I need to override the hashcode method for a class to get it hashmap
save.
In my case I have a class with double values. Normally i use the
algorithm from "Effectiv Java: override equals and hashCode". For
double it is to get a long with Double#doubleToLongBits(double) and
than add it to the result with "int c = (int)(f ^ (f >>> 32));"
Trying it out in HostMode results in an error: "The method
doubleToLongBits(double) is undefined for the type Double".
Do somebody knows a workaround or an alternative solution?
Thanks ahead!
best regards
qpid
--
Sandy McArthur
"He who dares not offend cannot be honest."
- Thomas Paine
Just want to clarify that in Javascript all numbers are doubles, which
gives you perfect emulation of all of Java's primitive types except
long, which has holes beyond 53-bit integers.
Sandy's suggestion to convert to a string and then hashing is a pretty
good one, though.
Ian
--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
best regards
qpid
On 26 Jun., 23:31, "Ian Petersen" <ispet...@gmail.com> wrote: