| Author |
sort list values
|
anvi kon
Ranch Hand
Joined: Jan 08, 2010
Posts: 133
|
|
hi,
Can anyone help me to get the least values from the List?
Here is the code below.
List lst = getvalues(String s);
I have three values:lst.size() =3
150,25,250.
I need to sort it and get the lowest value 25.
How would I do that in java?
Thanks,
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5852
|
|
Do you have a requirement to sort the list? Or just to get the smallest value?
If all you want is the smallest value, there's no need to sort.
If you want to sort, then java.util.Collections has a sort() method that takes a List parameter, or, if you need to write your own, google for sorting algorithms or check your textbook.
Once you've clarified your actual requirements and taken your best shot, post again, showing your efforts and asking a more specific question than, "How do I sort?"
Good luck!
|
 |
 |
|
|
subject: sort list values
|
|
|