Java Lambda - LongConsumer accept example








LongConsumer accept performs this operation on the given argument.

Syntax

accept has the following syntax.

void accept(long value)

Example

The following example shows how to use accept.

import java.util.function.LongConsumer;

public class Main {

  public static void main(String[] args) {
    LongConsumer i = (l) -> System.out.println(l);;
    i.accept(Long.MAX_VALUE);
  }
}

The code above generates the following result.