HashMap vs IdentityHashMap
Hello
I'm developing an application where a series of Client objects must be stored in a HashMap, using unique String ID values as keys. Every client has a unique ID, represented in a String key in the HashMap. Now I can't figure out whether I could be able to use IdentityHashMap instead of the regular HashMap. Here's what I found over at jGuru, but I'm not sure about the differences:
"The IdentityHashMap uses == for equality checking instead of equals(). This can be used for both performance reasons, if you know that two different elements will never be equals and for preventing spoofing, where an object tries to imitate another."
All I can come up with that looks like a potential bottleneck, is that I retrieve the Client ID numerics from incoming data over a network connection, I then use those Strings to get() the Client object in the HashMap.
While on the subject of HashMap's, I also have an Iterator looping through the HashMap at times, removing clients from it. However, due to it being fail-safe I must first move the ID's of clients-to-be-removed to a seperate collection, and when I'm finished I have to loop through that collection, removing every element in it from the client HashMap. Any ideas on how I could remove the clients immediately as I loop through the HashMap? Performance is trivial, as Client's are stored in a HashMap per Server (up to 20 000 clients per server theoretically).
Thank you

