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 .