| 限定符和类型 | 类和说明 |
|---|---|
static class |
Comparators.ComparatorHelper<T> |
static interface |
Comparators.Getter<T> |
| 构造器和说明 |
|---|
Comparators() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> Comparators.ComparatorHelper<T> |
ascBy(Comparators.Getter<T> getter)
参与对比的属性
|
static <T> void |
ascSort(List<T> list,
Comparators.Getter<T> getter)
对列表进行升序排序,为null排在前面
|
static <T> void |
ascSortNullLast(List<T> list,
Comparators.Getter<T> getter)
对列表进行升序排序,为null排在后面
|
static <T extends Comparable<T>> |
compare(T o1,
T o2) |
static <T> Comparators.ComparatorHelper<T> |
descBy(Comparators.Getter<T> getter)
参与对比的属性
|
static <T> void |
descSort(List<T> list,
Comparators.Getter<T> getter)
对列表进行降序排序,为null排在前面
|
static <T> void |
descSortNullLast(List<T> list,
Comparators.Getter<T> getter)
对列表进行降序排序,为null排在后面
|
static <T extends Comparable<T>> |
nullLastCompare(T o1,
T o2) |
static <T> Comparators.ComparatorHelper<T> |
orderBy(Comparators.Getter<T> getter)
参与对比的属性
|
static <T> Comparators.ComparatorHelper<T> |
orderBy(Comparators.Getter<T> getter,
boolean asc)
参与对比的属性
|
static <T> void |
sort(List<T> list,
Comparators.Getter<T> getter)
对列表进行升序排序,为null的排在前面
|
static <T> void |
sort(List<T> list,
Comparators.Getter<T> getter,
boolean asc)
对列表进行排序,为null的排在前面
|
static <T> void |
sortNullLast(List<T> list,
Comparators.Getter<T> getter)
对列表进行排序,为null排在后面
|
static <T> void |
sortNullLast(List<T> list,
Comparators.Getter<T> getter,
boolean asc)
对列表进行排序,为null排在后面
|
static int |
versionCompare(String version1,
String version2)
比较version1和version2,如果version1小于、等于、大于version2分别返回 -1、0、1
|
public static <T> Comparators.ComparatorHelper<T> orderBy(Comparators.Getter<T> getter)
getter - public static <T> Comparators.ComparatorHelper<T> orderBy(Comparators.Getter<T> getter, boolean asc)
getter - asc - 为true使用升序,为false使用降序public static <T> Comparators.ComparatorHelper<T> ascBy(Comparators.Getter<T> getter)
getter - public static <T> Comparators.ComparatorHelper<T> descBy(Comparators.Getter<T> getter)
getter - public static <T> void sort(List<T> list, Comparators.Getter<T> getter)
list - getter - public static <T> void sort(List<T> list, Comparators.Getter<T> getter, boolean asc)
list - getter - asc - public static <T> void sortNullLast(List<T> list, Comparators.Getter<T> getter)
list - getter - public static <T> void sortNullLast(List<T> list, Comparators.Getter<T> getter, boolean asc)
list - getter - asc - public static <T> void ascSort(List<T> list, Comparators.Getter<T> getter)
list - getter - public static <T> void descSort(List<T> list, Comparators.Getter<T> getter)
list - getter - public static <T> void ascSortNullLast(List<T> list, Comparators.Getter<T> getter)
list - getter - public static <T> void descSortNullLast(List<T> list, Comparators.Getter<T> getter)
list - getter - public static <T extends Comparable<T>> int compare(T o1, T o2)
o1 - o2 - public static <T extends Comparable<T>> int nullLastCompare(T o1, T o2)
o1 - o2 - Copyright © 2020. All rights reserved.