Java Lambda - LongUnaryOperator identity example

Returns a unary operator that always returns its input argument.


identity has the following syntax.

static LongUnaryOperator identity()


The following example shows how to use identity.

import java.util.function.LongUnaryOperator;
//from w  w w.j a va  2  s .co m
public class Main {

  public static void main(String[] args) {
    LongUnaryOperator i = LongUnaryOperator.identity();

The code above generates the following result.