
com.machinezoo.noexception.throwing.ThrowingComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of noexception Show documentation
Show all versions of noexception Show documentation
Makes exception handling concise and beautiful, yet architecturally clean and flexible.
// Part of NoException: https://noexception.machinezoo.com
package com.machinezoo.noexception.throwing;
import com.machinezoo.noexception.*;
/**
* Variation of {@link Comparator} that allows throwing checked exceptions.
* {@code ThrowingComparator} is usually implemented by a lambda
* and passed to {@link CheckedExceptionHandler#comparator(ThrowingComparator)}.
* See noexception tutorial.
*
* @param
* see {@link Comparator}
* @see CheckedExceptionHandler#comparator(ThrowingComparator)
* @see Comparator
*/
@FunctionalInterface public interface ThrowingComparator {
/**
* Variation of {@link Comparator#compare(Object, Object)} that allows throwing checked exceptions.
*
* @param left
* see {@link Comparator#compare(Object, Object)}
* @param right
* see {@link Comparator#compare(Object, Object)}
* @return see {@link Comparator#compare(Object, Object)}
* @throws Exception
* if unable to complete
* @see CheckedExceptionHandler#comparator(ThrowingComparator)
* @see Comparator#compare(Object, Object)
*/
int compare(T left, T right) throws Exception;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy