Java Lambda - BiFunction apply example








Applies this function to the given arguments.

Syntax

apply has the following syntax.

R apply(T t, U u)

Example

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("java2s.com", " tutorial"));
  }
}

The code above generates the following result.