Module com.machinezoo.noexception
Interface ThrowingComparator<T>
-
- Type Parameters:
-
T- seeComparator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ThrowingComparator<T>
Variation ofComparatorthat allows throwing checked exceptions.ThrowingComparatoris usually implemented by a lambda and passed toCheckedExceptionHandler.comparator(ThrowingComparator). See noexception tutorial.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcompare(T left, T right)Variation ofComparator.compare(Object, Object)that allows throwing checked exceptions.
-
-
-
Method Detail
-
compare
int compare(T left, T right) throws Throwable
Variation ofComparator.compare(Object, Object)that allows throwing checked exceptions.- Parameters:
-
left- seeComparator.compare(Object, Object) -
right- seeComparator.compare(Object, Object) - Returns:
-
see
Comparator.compare(Object, Object) - Throws:
-
Throwable- if unable to complete - See Also:
-
CheckedExceptionHandler.comparator(ThrowingComparator),Comparator.compare(Object, Object)
-
-