fuliqi
2024-12-05 918b26794c7d3b3faa2c57e6a6cb0c11ea4e73e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package enumeration;
 
public enum CompareType {
    MORE_THAN_EQ {
        @Override
        public <T extends Comparable<T>> boolean compare(T value, T threshold) {
            return value.compareTo(threshold) >= 0;
        }
    },
    LESS_THAN_EQ {
        @Override
        public <T extends Comparable<T>> boolean compare(T value, T threshold) {
            return value.compareTo(threshold) <= 0;
        }
    };
 
    public abstract <T extends Comparable<T>> boolean compare(T value, T threshold);
}