Avoid re-creating required action comparator (#29122)
closes #29130 Signed-off-by: Michal Růžička <michal.ruza@gmail.com>
This commit is contained in:
parent
a6e2ab5523
commit
ae1aaef96c
1 changed files with 5 additions and 11 deletions
|
@ -28,17 +28,11 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class RequiredActionProviderModel implements Serializable {
|
public class RequiredActionProviderModel implements Serializable {
|
||||||
|
|
||||||
public static class RequiredActionComparator implements Comparator<RequiredActionProviderModel> {
|
public interface RequiredActionComparator extends Comparator<RequiredActionProviderModel> {
|
||||||
public static final RequiredActionComparator SINGLETON = new RequiredActionComparator();
|
RequiredActionComparator SINGLETON = Comparator
|
||||||
|
.comparingInt(RequiredActionProviderModel::getPriority)
|
||||||
@Override
|
.thenComparing(RequiredActionProviderModel::getName, Comparator.nullsFirst(String.CASE_INSENSITIVE_ORDER))
|
||||||
public int compare(RequiredActionProviderModel o1, RequiredActionProviderModel o2) {
|
::compare;
|
||||||
|
|
||||||
return Comparator
|
|
||||||
.comparingInt(RequiredActionProviderModel::getPriority)
|
|
||||||
.thenComparing(RequiredActionProviderModel::getName, Comparator.nullsFirst(String.CASE_INSENSITIVE_ORDER))
|
|
||||||
.compare(o1, o2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
Loading…
Reference in a new issue