58 lines
1.2 KiB
Java
58 lines
1.2 KiB
Java
|
package info.ebenoit.ebul.func;
|
||
|
|
||
|
|
||
|
import java.util.function.LongBinaryOperator;
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* This interface supports a {@link LongBinaryOperator} that can throw checked exceptions. Checked exceptions are
|
||
|
* transmitted using a {@link FunctionException} runtime exception.
|
||
|
*
|
||
|
* @author <a href="mailto:ebenoit@ebenoit.info">E. Benoît</a>
|
||
|
*/
|
||
|
@FunctionalInterface
|
||
|
public interface ThrowingLongBinaryOperator
|
||
|
extends LongBinaryOperator
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* Applies this function to the given arguments.
|
||
|
*
|
||
|
* @param t
|
||
|
* the first argument
|
||
|
* @param u
|
||
|
* the second argument
|
||
|
* @return the result
|
||
|
* @throws FunctionException
|
||
|
* if a checked exception occurs
|
||
|
*/
|
||
|
@Override
|
||
|
default long applyAsLong( final long t , final long u )
|
||
|
{
|
||
|
try {
|
||
|
return this.throwingApplyAsLong( t , u );
|
||
|
} catch ( final RuntimeException e ) {
|
||
|
throw e;
|
||
|
} catch ( final Throwable e ) {
|
||
|
throw new FunctionException( e );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Applies this function to the given arguments.
|
||
|
*
|
||
|
* @param t
|
||
|
* the first argument
|
||
|
* @param u
|
||
|
* the second argument
|
||
|
* @return the result
|
||
|
* @throws Throwable
|
||
|
* any exception
|
||
|
*/
|
||
|
public long throwingApplyAsLong( long t , long u )
|
||
|
throws Throwable;
|
||
|
|
||
|
}
|