Why is there no Equals() or GetHashCode() in ArrayList?

E

eramfelt

Why doesnt ArrayList implements the Equals() or GetHashCode() methods?
How is the developer supposed to check if an array list is equal to
another array list? Is the developer supposed to iterate through the
array list to find out if they are equal or not? This should be handled
by the framework classes and I don't want to do any unnecessary
implementation (read copy-paste-problems).

If I look through the other classes in System.Collection I see that no
implements GetHashCode() or Equals(). If none of them do, then it must
be a design choice. But what design choice would that be? If anyone
have any explanation, please let me know.I really want to know.

There is an interface in System.Collections.Generic that is named
IEqualityComparer, which has two methods, Equals() and GetHashCode().
Why make an interface when every class implements those methods? And
why doesn't the default list/collection classes implement this
interface?


<flamebait-to-be-ignored>
If I look to Java, the ArrayList implements equals(), hashCode() as all
good objects should. They have also a good explanation on how it is
done here.
http://shorl.com/gogedrikekati
http://shorl.com/fygafrebrypeko
</flamebait-to-be-ignored>

Regards
http://redsolo.blogspot.com
 
E

eramfelt

Sorry for the double post into this group. This message was intended
for microsoft.public.dotnet.framework. Please reply to the message in
that group.

Sorry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top