npublic class EmpSort {
n static final Comparator<Employee>
SENIORITY_ORDER = new Comparator<Employee>()
{
n public int compare(Employee e1,
Employee e2) {
n return
e2.hireDate().compareTo(e1.hireDate()); }
n };
n
// Employee database
n static final Collection<Employee>
employees = ... ;
n public static void main(String[] args) {
n List<Employee>e = new
ArrayList<Employee>(employees);
n Collections.sort(e, SENIORITY_ORDER);
System.out.println(e);
n }
n}