HashSet

  1. There’s no need to call equals if hashCode differs
  2. There’s no need to call hashCode if (obj1 == obj2)
  3. There’s no need for hashCode and/or equals just to iterate – you’re not comparing objects
  4. When needed to distinguish in between objects.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s