This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference betwwen Sorted and Ordered Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference betwwen Sorted and Ordered" Watch "Difference betwwen Sorted and Ordered" New topic

Difference betwwen Sorted and Ordered

jaspreet atwal
Ranch Hand

Joined: Sep 05, 2007
Posts: 52

Somebody please explain to me or direct me to somewhere I can understand how Sorted and Ordered are different.


Still Learing..
Tejas V Shah

Joined: Mar 20, 2008
Posts: 20
Hi Jaspreet,

I found on net regarding difference between sort and order.

sort: To arrange (things, etc.) according to a kind or quality, or
after some settled order or system; to separate and put into
different sorts or classes.

order: The action of putting or keeping in order.

in order: In proper sequence or succession, according to rank,
importance, seniority, size, position, date, affinity, etc.
Antonio Tercero
Ranch Hand

Joined: Jun 05, 2008
Posts: 110
Ordered : when a collection is ordered it means you can iterate through the collection in a specific order. An ArrayList is ordered by index.

Sorted : when a collection contains objects that are organized according to some rules. A TreeSet is a sorted collection because its elements are organized in ascending order(it has nothing to do with what position it was added at)

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Difference betwwen Sorted and Ordered
It's not a secret anymore!