This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In collections can have either ordered or sorted or both...if it is sorted its implicitly ordered ( sort is kind of order) well here is the e.g When you enter something in a collection say tom tim apple orange and when you access it will come in the same order as above. in case as sorted when you access the collection you will get apple orange tim tom I guess that helps - Venkatesh
SCJP 1.4, SCWCD<p>Ours is a world where people don't know what they want and are willing to go through hell to get it.<br /> - Don Marquis
Hi: Order: as per definition, mean to put things into their proper places in RELATION to each other. eg., Arrange the given numbers in ascending ORDER 5 2 4 6 Result: 2 4 5 6
Sort: as per definition, a GROUP set up on the basis of any characteristic in common eg., Sort the following magazines by their catagory. HBR, PC World, ACM Magazine, BusinessWeek, Fortune Result: Business Magazines:HBR, BusinessWeek, Fortune Computer Magazines: PC World, ACM Hope this helps.
I have to disagree with srini here; that doesn't make any sense in this context. Venkatesh's explanation is much more accurate. If a collection is ordered, that means that the sequence that the elements occur in is significant. If you're using a List, there's a difference between 1, 2, 3 and 1, 3, 2. If you'r using a Set, there's no difference (or if there is, you should ignore it as unimportant). That's because a List is ordered, and a Set isn't. Now to sort a List is to put it in a particular order, according to some rule. In the collections framework the rule is always provided by a compareTo() or compare() method, as defined in the Comparable or Comparator interfaces. All sorted collections are also ordered, because if the order wasn't signficant, there's be no point to trying to sort it. But not all ordered collections are sorted.