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.
The following example shows how to use LongUnaryOperator
.
import java.util.function.LongUnaryOperator; //from w w w .j av a 2 s. com 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.