Originally posted by Dave Vick:
You could convert the vecotr to an array and sort it using one of the sort method in the Arrays class. You'd have to create a comparator to do it but if your vector is fairly large this would probably be more efficient than writiing your own sort method. something like this:
Rather than convert it to an array, you could just use the Collections sort method. To modify your example:
Next, without changing the Vector to an array: