Java Lambda - BiFunction apply example

Applies this function to the given arguments.


apply has the following syntax.

R apply(T t, U u)


The following example shows how to use apply.

import java.util.function.BiFunction;
//from ww  w .j  av  a  2 s.  c  o m
public class Main {
  public static void main(String[] args) {
    BiFunction<String, String,String> bi = (x, y) -> {      
      return x + y;

    System.out.println(bi.apply("", " tutorial"));

The code above generates the following result.