Re: hashcode values
Wizumwalt@gmail.com wrote On 06/07/06 16:55,:
I thought of this, and thought it would be slow, but I'll do that
instead then, since I really depend on unique values.
However, that part could also be further improved, but that's another
question, and to get more help on that, it would probably need more input
from you on what you actually is trying to do; what you want to use the code
for.
Well, I need to get at what element my mouse is hovering over and the
only data I have is the pixel's color coding. So I use this color
coding to grab the id of the element that was originally drawn on the
canvas and convert it back to an id from this lookup.
If you can get a Color object that represents the
pixel's color, why mess around with a String representation
at all? Color has a hashCode() method of its own, and a
Color is a perfectly good key for a Hashtable or HashMap.
It's probably a lot quicker to compute the hashCode of a
Color than to turn the Color into a String and compute
the hashCode of the String. It's certainly more convenient!
--
Eric.Sosman@sun.com