T - parameter one
U - parameter two
R - result
There are two methods in the BiFunction interface, as follows.
//andThen will be executed last default <V> BiFunction<T,U,V> andThen(Function<? super R,? extends V> after) R apply(T t, U u)BiFunction usage example, as follows.
import java.util.function.BiFunction; import java.util.function.Function; public class TestDemo { public static void main(String[] args) { BiFunction<String, String,String> biFunction = (x, y) -> { return x+"==="+y; }; Function<String,String> fun = x ->x + " after8"; System.out.println(biFunction.andThen(fun).apply("tpyyes.com ", " java8")); } }output String.
tpyyes.com === java8 after8
No comments:
Post a Comment
Note: only a member of this blog may post a comment.