Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Sorting problem in Java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi *.*,
I have a general doubt in sorting of Java objects. I have a List which contain a set of java beans called "Cars". Each Cars bean has an attribute called "age". When I retrieve the List using another method, I dont get the List in a sorted manner.
I want to sort this List based on the attribute "age".
Which is the better apporach to do this sorting. Can I use Collection.sort() for this.
Here performance also is a problem. But one thing I can say is the size of the List is only about 20 max.

Thanks in Advance,
Regards,
Krishna Mohan R
rkmohan007@gmail.com
 
Marshal
Posts: 76840
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't ask the same question twice.
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic