All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.organicdesign.fp.function.package.html Maven / Gradle / Ivy



Exception-friendly functional interfaces named by the number of arguments: Function0, Function1, Function2.... All of these have an apply() method that that throws an Exception and returns a result. Implementers should override the apply method. Each interface also has a default apply_() method for consumers of this function to call. It re-throws all exceptions after wrapping any checked exceptions in unchecked RuntimeExceptions.

For simplicity, there are no primitive versions of these functions, no "void" return types (except SideEffect), and no special-purpose funny names. If you don't want to return a result, declare the return type as ? and return null. Comparing just the Consumer interfaces from { @link java.util.function}:

java.util.functionorg.organicdesign.fp.function
Consumer<T>Function1<T,?>
DoubleConsumerFunction1<Double,?>
IntConsumerFunction1<Integer,?>
LongConsumerFunction1<Long,?>
BiConsumer<T,U>Function2<T,U,?>
ObjDoubleConsumer<T>Function2<T,Double,?>
ObjIntConsumer<T>Function2<T,Integer,?>
ObjLongConsumer<T>Function2<T,Long,?>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy