Functions: FnFunc

1. Overview

FnFunc is a function hub class containing basic static methods that operate on Objects

2. Functions

Function nameTypeParamsDescription
chainFunction<X,Z>IFunction<X,Y> fn1
IFunction<? super Y,Z> fn2

Chains two functions together. The returned function executes the specified functions in sequence, being fn2 executed on the results of fn1.

ifFalseThenFunction<T,T>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is false.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifFalseThenElseFunction<T,R>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifNotNullAndFalseThenFunction<T,T>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on it is false.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifNotNullAndFalseThenElseFunction<T,R>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifNotNullAndTrueThenFunction<T,T>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on it is true.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifNotNullAndTrueThenElseFunction<T,R>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the target object is not null and the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifNotNullThenFunction<T,T>Type<T> targetType
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the target object is not null.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifNotNullThenElseFunction<T,R>Type<T> targetType
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the target object is not null, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifNullOrFalseThenFunction<T,T>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on it is false.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifNullOrFalseThenElseFunction<T,R>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on the target object is false, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifNullOrTrueThenFunction<T,T>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on it is true.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifNullOrTrueThenElseFunction<T,R>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the target object is null or the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifNullThenFunction<T,T>Type<T> targetType
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the target object is null.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifNullThenElseFunction<T,R>Type<T> targetType
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the target object is null, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

ifTrueThenFunction<T,T>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,? extends T> thenFunction

Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is true.

The built function cannot change the return type (receives T and returns T) because the thenFunction could remain unexecuted, and so the type returned by thenFunction must be the same as the type required as input, in order to keep consistency.

ifTrueThenElseFunction<T,R>Type<T> targetType
IFunction<? super T, Boolean> condition
IFunction<? super T,R> thenFunction
IFunction<? super T,R> elseFunction

Builds a function that will execute the specified function thenFunction only if the result of executing condition on the target object is true, and will execute the specified function elseFunction otherwise.

The built function can effectively change the target type (receive T and return R) if both thenFunction and elseFunction return the same type, and this is different than the target type T.

whileFalseFunction<T,T>IFunction<? super T, Boolean> condition
IFunction<? super T, T> function

Executes the specified function iteratively (first on the target, then on the result of the previous iteration) while the result of executing the condition function on the target object (or the result of the previous function iteration) is false.

whileTrueFunction<T,T>IFunction<? super T, Boolean> condition
IFunction<? super T, T> function

Executes the specified function iteratively (first on the target, then on the result of the previous iteration) while the result of executing the condition function on the target object (or the result of the previous function iteration) is true.