T
- 用于比较的对象类型public class InstanceComparator<T> extends Object implements Comparator<T>
如果对比的两个对象类型相同,返回0
,默认如果对象类型不在列表中,则排序在前
此类来自Spring,有所改造
Constructor and Description |
---|
InstanceComparator(boolean atEndIfMiss,
Class<?>... instanceOrder)
构造
|
InstanceComparator(Class<?>... instanceOrder)
构造
|
Modifier and Type | Method and Description |
---|---|
int |
compare(T o1,
T o2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public InstanceComparator(Class<?>... instanceOrder)
instanceOrder
- 用于比较排序的对象类型数组,排序按照数组位置排序public InstanceComparator(boolean atEndIfMiss, Class<?>... instanceOrder)
atEndIfMiss
- 如果不在列表中是否排在后边instanceOrder
- 用于比较排序的对象类型数组,排序按照数组位置排序public int compare(T o1, T o2)
compare
in interface Comparator<T>
Copyright © 2024. All rights reserved.