Interface BiFunction<T,U,R>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Type Parameters:
T - the type of the first argument to the function
U - the type of the second argument to the function
R - the type of the result of the function
BiFunction Method:
- //Returns a composed function that first applies this function to its input, and then applies the after function to the result.
- default <V> BiFunction<T,U,V> andThen(Function<? super R,? extends V> after)
- //Applies this function to the given arguments.
- R apply(T t, U u)
BiFunction Example:
- 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:
- tpyyes.com === java8 after8
No comments:
Post a Comment
Note: only a member of this blog may post a comment.