Good day!
I have an object student with the following attributes:
class Student
String name
Date birthday
I used arrayList
You can pass a Comparator to Collections.sort() to handle the sorting by birthday:
Collections.sort(studentList, new Comparator() {
public int compare(Student s1, Student s2) {
return s1.getBirthday().compareTo(s2.getBirthday());
}
});
You'll need to add getBirthday() to your Student class if you don't have it already.