File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference betwwen Sorted and Ordered
 
Similar Threads
Collection Doubt
Ordered and Sorted
ordered and sorted
Difference between sorted and ordered?
Is both Vector and Hashtable maintains object references in the order they were added?