This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes LinkedHashSet is an ordered set Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "LinkedHashSet is an ordered set" Watch "LinkedHashSet is an ordered set" New topic
Author

LinkedHashSet is an ordered set

Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: LinkedHashSet is an ordered set
 
Similar Threads
collections framework
Collections
TreeSet
order of elements returned by Iterator in Set
collections- Odered,sorted etc