java面向接口
public class Program2 {public static void main(String[] args) {Run();}public static void Run() {List<Student2> list = new ArrayList<Student2>();list.add(new Student2("aaa", 18));list.add(new Student2("bbb", 15));list.add(new Student2("ccc", 17));Student2 stu = ScanPDF(list, new ITest<Student2>() {public boolean Compare(Student2 t1, Student2 t2) {return t1.getAge() >= t2.getAge();}});System.out.println(stu.getAge());}public static Student2 ScanPDF(List<Student2> list, ITest c) {Student2 result = null;for (Student2 stu : list) {result = result == null ? stu : (c.Compare(result, stu) ? result : stu);}return result;}}
?