LongUnaryOperator example
Description
LongUnaryOperator represents an operation on a single long-valued operand that produces a long-valued result. This is the primitive type specialization of UnaryOperator for long.
Example
The following example shows how to use LongUnaryOperator
.
import java.util.function.LongUnaryOperator;
/*from ww w .j a v a 2 s . c o m*/
public class Main {
public static void main(String[] args) {
LongUnaryOperator i = (l) -> -l;
System.out.println(i.applyAsLong(Long.MAX_VALUE));
}
}
The code above generates the following result.
Home »
Java Lambda »
java.util.function Reference »
Java Lambda »
java.util.function Reference »