DoubleUnaryOperator identity example
Description
DoubleUnaryOperator identity returns a unary operator that always returns its input argument.
Syntax
identity
has the following syntax.
static DoubleUnaryOperator identity()
Example
The following example shows how to use identity
.
import java.util.function.DoubleUnaryOperator;
// w w w . java2 s. c o m
public class Main {
public static void main(String[] args) {
DoubleUnaryOperator id = DoubleUnaryOperator.identity();
System.out.println(id.applyAsDouble(3.14));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »