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
It is sorta covered in the
JavaRanch Style Guide
subject: how to sort out elements in vector objects
Sort vector contennts
Class Cast Exception - Please help
Vectors vs Arrays
order of elements in Vector
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014