A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
how to sort out elements in vector objects
Joined: Oct 10, 2002
May 22, 2003 13:55:00
how to sort out elements in vector objects?
Joined: Jan 30, 2002
May 22, 2003 13:59:00
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:
subject: how to sort out elements in vector objects
order of elements in Vector
Sort vector contennts
Vectors vs Arrays
Class Cast Exception - Please help
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014