public static <T, R> Function<T, R> doIf(final Predicate<T> condition, final CheckedFunction<T, R> trueFunction,
                                             final CheckedFunction<T, R> falseFunction) {
        return t -> {
            try {
                if (condition.test(t)) {
                    return trueFunction.apply(t);
                }
                return falseFunction.apply(t);
            } catch (final Throwable e) {
                LOGGER.warn(e.getMessage(), e);
                try {
                    return falseFunction.apply(t);
                } catch (final Throwable ex) {
                    throw new IllegalArgumentException(ex.getMessage());
                }
            }
        };
    }
public static < T , R > Function < T , R > doIf ( final Predicate < T > condition , final CheckedFunction < T , R > trueFunction , final CheckedFunction < T , R > falseFunction ) { return t -> { try { if ( condition . test ( t ) ) { return trueFunction . apply ( t ) ; } return falseFunction . apply ( t ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; try { return falseFunction . apply ( t ) ; } catch ( final Throwable ex ) { throw new IllegalArgumentException ( ex . getMessage ( ) ) ; } } } ; }
Conditional function function.

@param <T>           the type parameter
@param <R>           the type parameter
@param condition     the condition
@param trueFunction  the true function
@param falseFunction the false function
@return the function