This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sort list values

 
anvi kon
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic