Package de.xima.fc.utils
Class XComparisonUtils
- java.lang.Object
-
- de.xima.fc.utils.XComparisonUtils
-
public class XComparisonUtils extends Object
Utilities forComparator
andComparable
.- Since:
- 2.1.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Comparator<T>
comparingInStages(Comparator<T>... stages)
Creates a comparator that compares items in stages.
-
-
-
Method Detail
-
comparingInStages
@SafeVarargs public static <T> Comparator<T> comparingInStages(Comparator<T>... stages)
Creates a comparator that compares items in stages. Compared to building the comparator viaComparator.thenComparing(Comparator)
, this method better support type parameter inference.- Type Parameters:
T
- Type of the items.- Parameters:
stages
- Stages by which to compare.- Returns:
- A comparator that compares first by the first comparator, then by the second comparator if they are equal, then by the third comparator etc.
-
-