I have one ArrayList<Users> users_list; and in users i have name, surname, age etc. I want to implement an sorting algorithm that will sort my arraylist based on users age. I searched a lot but found only for sorting arrays.
2 Answers
Take a look here. JavaBeans Comparison. The second answer seems to be more to the point.
I would suggest using http://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections/ComparatorUtils.html#naturalComparator()
as the comparator parameter of the BeanComparator.