File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to sort out elements in vector objects 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 » Java » Java in General
Bookmark "how to sort out elements in vector objects" Watch "how to sort out elements in vector objects" New topic
Author

how to sort out elements in vector objects

senthil sen
Ranch Hand

Joined: Oct 10, 2002
Posts: 184
how to sort out elements in vector objects?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Look at Collections.sort(). If the elements implement Comparable then you can just do this:

If not then you can provide a Comparator like this:


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to sort out elements in vector objects
 
Similar Threads
Java Vector
Sort vector contennts
Class Cast Exception - Please help
order of elements in Vector
Vectors vs Arrays