
net.mintern.functions.unary.checked.BoolToObjE Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functions-unary-extended Show documentation
Show all versions of functions-unary-extended Show documentation
Provides functional interfaces for most two-argument functions
The newest version!
package net.mintern.functions.unary.checked;
/**
* An operation of type {@code (boolean) -> R}.
*
* @param the type of the return value
* @param the {@code Exception} type that the operation may throw
*/
@FunctionalInterface
public interface BoolToObjE {
/**
* Performs this operation.
*
* @param bool the argument
* @return the result of the operation
* @throws E if the operation cannot be completed
*/
R call(boolean bool) throws E;
/**
* Binds {@code (bool)} to {@code f}, returning a new function
* of type {@code () -> R}.
*
* @param the type of the return value
* @param the {@code Exception} type that the operation may throw
* @param f the unbound function
* @param bool the argument
* @return a new function {@code () -> R} that calls
* {@code f.call(bool)} and returns the result.
*/
@SuppressWarnings("unchecked") // maven spuriously warns about a type error in this case
static net.mintern.functions.nullary.checked.NilToObjE
bind(BoolToObjE f, boolean bool) {
return () -> f.call(bool);
}
/**
* Binds {@code (bool)} to {@code this}, returning a new function
* of type {@code () -> R}.
*
* @param bool the argument
* @return a new function {@code () -> R} that calls
* {@code this.call(bool)} and returns the result.
*/
default net.mintern.functions.nullary.checked.NilToObjE bind(boolean bool) {
return BoolToObjE.bind(this, bool);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy