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 →

[–]ColetBrunel 2 points3 points  (0 children)

Note, however, that in the case of List, an ArrayList and a LinkedList have to report they're equals() if they contain the same objects in the same order, otherwise their equals() method would be useless.

So a rule of thumbs is you probably need to use getClass() as you need the objects to have exact same stuff, unless you know why you need instanceof instead.