aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Sort of collections by Collections.sort(..) 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 "Sort of collections by Collections.sort(..)" Watch "Sort of collections by Collections.sort(..)" New topic
Author

Sort of collections by Collections.sort(..)

Pawanpreet Singh
Ranch Hand

Joined: Jun 12, 2005
Posts: 264

We know that we can only do sort of List by Collections.sort,

We can not do sort HashSet, HashMap and Hashtable.....because they are uordered. But LinkHashSet and LinkedHashMap are there as ordered by insertion.

So could anybody tell me that can we sort LinkHashSet and LinkedHashMap also by some way.

Sincerely,
Pawan
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

If you want sorted sets and maps go for TreeMap and TreeSet.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Pankaja Shinde
Ranch Hand

Joined: Sep 15, 2006
Posts: 87
no way
we can't change the functionality of LinkedHashSet and LinkedHashMap.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sort of collections by Collections.sort(..)