Thursday, November 7, 2013

What is the difference between an Ordered and Sorted Collection?



Ordered:
- An ordered collection means that the elements of the collection have a specific order. The order is independent of the value. A List is an example.

Sorted:
- A sorted collection means that not only does the collection have order, but the order depends on the value of the element. A SortedSet is an example.

-- In contrast, a collection without any order can maintain the elements in any order. A Set is an example.



No comments:

Post a Comment