public static <T, R> Predicate<T> compose(Predicate<R> predicate, Function<T, R> function) {
        dbc.precondition(predicate != null, "cannot compose function with a null predicate");
        dbc.precondition(function != null, "cannot compose predicate with a null function");
        return t -> predicate.test(function.apply(t));
    }
public static < T , R > Predicate < T > compose ( Predicate < R > predicate , Function < T , R > function ) { dbc . precondition ( predicate != null , "cannot compose function with a null predicate" ) ; dbc . precondition ( function != null , "cannot compose predicate with a null function" ) ; return t -> predicate . test ( function . apply ( t ) ) ; }
Composes a predicate with a function (predicate ° function).

@param <T> the function parameter type
@param <R> the predicate parameter type, the function result type
@param predicate the predicate to be composed
@param function the function to be composed
@return the composed predicate