// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SpecialMax {
    public static void main(String[] args) {
        List<Employee> lst = new ArrayList<Employee>();
        lst.add(new Employee("A", 20000));
        lst.add(new Employee("B", 25000));
        lst.add(new Employee("C", 30000));
        lst.add(new Employee("D", 25000));
        System.out.println(bestPaidEmployee(lst));
    }
    public static Employee bestPaidEmployee(List<Employee> lst)
    {
        return Collections.max(lst, new Comparator<Employee>() {
            public int compare(Employee o1, Employee o2) {
                return o1.getSalary() - o2.getSalary();
            }
        } );
    }
}

class Employee {
    private String name;
    private int salary;
    public Employee(String name, int salary) {
        this.name = name;
        this.salary = salary;
    }
    public String getName() {
        return name;
    }
    public int getSalary() {
        return salary;
    }
    public String toString() {
        return name;
    }
}
