Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference betwwen Sorted and Ordered" Watch "Difference betwwen Sorted and Ordered" New topic
Author

Difference betwwen Sorted and Ordered

jaspreet atwal
Ranch Hand

Joined: Sep 05, 2007
Posts: 52
Hi,

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

Thanks!


Still Learing..
Tejas V Shah
Greenhorn

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)


SCJP 5, SCWCD 5
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Difference betwwen Sorted and Ordered