BiConsumer example

Description

BiConsumer represents an operation that accepts two input arguments and returns no result.

Example

The following example shows how to use BiConsumer.


import java.util.function.BiConsumer;
/*from   w  ww  .  j a  v a 2  s .  co m*/
public class Main {
  public static void main(String[] args) {
    BiConsumer<String, String> biConsumer = (x, y) -> {
      System.out.println(x);
      System.out.println(y);
    };

    biConsumer.accept("java2s.com", " tutorials");
  }
}

The code above generates the following result.