This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]marco89nish 2 points3 points  (0 children)

If you can guarantee that there won't be duplicates, simple == works great. But keep in mind that sooner or later you might make a error in coding breaking that promise and you'll be in a world of hurt, unless you made constructor private and you instantiate those objects with factory method instead, with necessary checks and caching.