posted 20 years ago
I am reading a book that says a LinkedHashSet is an ordered set.
We call a set sorted (SortedSet) when the iterator returns the elements sorted. So I suppose we can call a set ordered when the iterator returns the elements in some predictable order.
We know that a List is an ordered collection. We know that two instances of a List are *equal* if they contain the same elements *in the same order*.
However, two instances of a LinkedHashSet are equal if they contain the same elements, although the elements might not be in the same order.
The order is essential to the identity of a List instance. The order is not essential to the identity of a LinkedHashSet instance.
Saying a List is an ordered collection is different in degree from saying that a LinkedHashSet is an ordered set.