package com.sf.day16;

import java.util.Comparator;

public class MyUserCompare implements Comparator {
    @Override
    public int compare(Object o1, Object o2) {
        if(o1 instanceof User && o2 instanceof User){
            User user1 = (User) o1;
            User user2 = (User) o2;
                return user1.age - user2.age;
        }
        throw new RuntimeException("类型不匹配");
    }
}
