DoubleUnaryOperator is a functional interface that represents an operation on a single double-valued argument and produces a double-valued result. The applyAsDouble() method is the functional method of the interface.
The DoubleUnaryOperator interface is defined in the java.util.function package. To import the DoubleUnaryOperator interface check the following import statement.
import java.util.function.DoubleUnaryOperator;
double applyAsDouble(double operand);
double operand: The double valued operand.This method returns a double valued result.
import java.util.function.DoubleUnaryOperator;public class Main {public static void main(String[] args){DoubleUnaryOperator squareOfNumFunction = num -> num * num;double arg = 5.43;System.out.println("Result of applyAsDouble() on squareOfNumFunction --> " + squareOfNumFunction.applyAsDouble(arg));}}
DoubleUnaryOperator interface from the function package.DoubleUnaryOperator interface called squareOfNumFunction. squareOfNumFunction accepts a double-valued argument and returns the result square of the given argument.double value called arg.applyAsDouble() method and pass arg as an argument.