Why above code is not throwing assertion error at line 1? Thanks Barkat
Andres Gonzalez
Ranch Hand
Joined: Nov 27, 2001
Posts: 1561
posted
0
hmm... good question. I do not know the answer, but I'd like to add one more thing: If you don't override equals, two objects are considered equals if they referred to the same object. probably it does not have anything to do with the question itself. any other opinions? [ July 24, 2003: Message edited by: Andres Gonzalez ]
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Barkat Mardhani
Ranch Hand
Joined: Aug 05, 2002
Posts: 787
posted
0
I did little research on it. The equals method of LinkedList class will apply. And it is overridden. Per it's definition if two collections have same elements in same order, they considered same or in other words equal. Hope this helps. Barkat
Andres Gonzalez
Ranch Hand
Joined: Nov 27, 2001
Posts: 1561
posted
0
Originally posted by Barkat Mardhani: I did little research on it. The equals method of LinkedList class will apply. And it is overridden. Per it's definition if two collections have same elements in same order, they considered same or in other words equal. Hope this helps. Barkat
Thanks Barkat. I wonder if the overriding of equals is also done for all collection classes, besides LinkedList (according to you). [ July 24, 2003: Message edited by: Andres Gonzalez ]
Barkat Mardhani
Ranch Hand
Joined: Aug 05, 2002
Posts: 787
posted
0
Thanks Barkat. I wonder if the overriding of equals is also done for all collection classes, besides LinkedList (according to you).
I checked couple more. Seems they overridden either in Abstractxxxx class or concrete class.