This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I read somewhere that String objects oppose to Integer Objects are far better to use as the key for HashMap because strings are immutable. On the other hand, a recent post by someone on here, said that Integer Objects are better than String Objects to use as keys because they are efficient when searching. Could anyone explain to me which is better to use? Thank you in advance. Allen
If *immutable* is the reason, then even Integer objects are immutable. Can you post the link?
Joined: Jul 02, 2002
Here is the link that says to use Strings as the keys: (Slide 15) www.cis.upenn.edu/~matuszek/cit594-2002/ Slides/using-maps.ppt Here is the link that says Integers are better performing saloon.javaranch.com/34/002109.html posted by ranch hand Steve Deadsea, but I think he is talking about HashTable. Same concept? Thanks