@ SneakyThrows public static < R > Supplier < R > doIfNotNull ( final Object input , final Supplier < R > trueFunction , final Supplier < R > falseFunction ) { return ( ) -> { try { if ( input != null ) { return trueFunction . get ( ) ; } return falseFunction . get ( ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; return falseFunction . get ( ) ; } } ; }
Supply if not null supplier .