DoubleUnaryOperator
Stay organized with collections
Save and categorize content based on your preferences.
Public Methods
Returns a composed operator that first applies this operator to
its input, and then applies the after
operator to the result.
If evaluation of either operator throws an exception, it is relayed to
the caller of the composed operator.
Parameters
after |
the operator to apply after this operator is applied |
Returns
- a composed operator that first applies this operator and then
applies the
after
operator
public
abstract
double
applyAsDouble
(double operand)
Applies this operator to the given operand.
Returns a composed operator that first applies the before
operator to its input, and then applies this operator to the result.
If evaluation of either operator throws an exception, it is relayed to
the caller of the composed operator.
Parameters
before |
the operator to apply before this operator is applied |
Returns
- a composed operator that first applies the
before
operator and then applies this operator
Returns a unary operator that always returns its input argument.
Returns
- a unary operator that always returns its input argument
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eDoubleUnaryOperator\u003c/code\u003e is a functional interface representing an operation on a single \u003ccode\u003edouble\u003c/code\u003e input that produces a \u003ccode\u003edouble\u003c/code\u003e output.\u003c/p\u003e\n"],["\u003cp\u003eIt is a specialization of \u003ccode\u003eUnaryOperator\u003c/code\u003e for \u003ccode\u003edouble\u003c/code\u003e primitive type.\u003c/p\u003e\n"],["\u003cp\u003eThe core method is \u003ccode\u003eapplyAsDouble(double)\u003c/code\u003e which applies the operation to the given operand.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDoubleUnaryOperator\u003c/code\u003e provides methods for composing operators like \u003ccode\u003eandThen\u003c/code\u003e and \u003ccode\u003ecompose\u003c/code\u003e to chain operations.\u003c/p\u003e\n"],["\u003cp\u003eIt also includes an \u003ccode\u003eidentity\u003c/code\u003e method that returns an operator returning its input unchanged.\u003c/p\u003e\n"]]],["`DoubleUnaryOperator` is a functional interface for operations on `double` values. It has the `applyAsDouble` method, which applies the operator to a given operand. `andThen` composes operators, applying the current operator first, then the `after` operator. `compose` composes operators, applying the `before` operator first, then the current one. `identity` provides a unary operator that returns its input. These methods manage single or multiple operator application and return composed operations.\n"],null,["# DoubleUnaryOperator\n\npublic interface **DoubleUnaryOperator** \nRepresents an operation on a single `double`-valued operand that produces\na `double`-valued result. This is the primitive type specialization of\n[UnaryOperator](../../../../reference/java/util/function/UnaryOperator.html) for `double`.\n\nThis is a [functional interface](/j2objc/javadoc/jre/reference/java/util/function/package-summary)\nwhose functional method is [applyAsDouble(double)](../../../../reference/java/util/function/DoubleUnaryOperator.html#applyAsDouble(double)). \n\n##### See Also\n\n- [UnaryOperator](../../../../reference/java/util/function/UnaryOperator.html) \n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) | [andThen](../../../../reference/java/util/function/DoubleUnaryOperator.html#andThen(java.util.function.DoubleUnaryOperator))([DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) after) Returns a composed operator that first applies this operator to its input, and then applies the `after` operator to the result. |\n| abstract double | [applyAsDouble](../../../../reference/java/util/function/DoubleUnaryOperator.html#applyAsDouble(double))(double operand) Applies this operator to the given operand. |\n| [DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) | [compose](../../../../reference/java/util/function/DoubleUnaryOperator.html#compose(java.util.function.DoubleUnaryOperator))([DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) before) Returns a composed operator that first applies the `before` operator to its input, and then applies this operator to the result. |\n| static [DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) | [identity](../../../../reference/java/util/function/DoubleUnaryOperator.html#identity())() Returns a unary operator that always returns its input argument. |\n\nPublic Methods\n--------------\n\n#### public [DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html)\n**andThen**\n([DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) after)\n\nReturns a composed operator that first applies this operator to\nits input, and then applies the `after` operator to the result.\nIf evaluation of either operator throws an exception, it is relayed to\nthe caller of the composed operator. \n\n##### Parameters\n\n| after | the operator to apply after this operator is applied |\n|-------|------------------------------------------------------|\n\n##### Returns\n\n- a composed operator that first applies this operator and then applies the `after` operator \n\n##### Throws\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if after is null |\n|-----------------------------------------------------------------------------------|------------------|\n\n##### See Also\n\n- [compose(DoubleUnaryOperator)](../../../../reference/java/util/function/DoubleUnaryOperator.html#compose(java.util.function.DoubleUnaryOperator)) \n\n#### public abstract double\n**applyAsDouble**\n(double operand)\n\nApplies this operator to the given operand. \n\n##### Parameters\n\n| operand | the operand |\n|---------|-------------|\n\n##### Returns\n\n- the operator result \n\n#### public [DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html)\n**compose**\n([DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html) before)\n\nReturns a composed operator that first applies the `before`\noperator to its input, and then applies this operator to the result.\nIf evaluation of either operator throws an exception, it is relayed to\nthe caller of the composed operator. \n\n##### Parameters\n\n| before | the operator to apply before this operator is applied |\n|--------|-------------------------------------------------------|\n\n##### Returns\n\n- a composed operator that first applies the `before` operator and then applies this operator \n\n##### Throws\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if before is null |\n|-----------------------------------------------------------------------------------|-------------------|\n\n##### See Also\n\n- [andThen(DoubleUnaryOperator)](../../../../reference/java/util/function/DoubleUnaryOperator.html#andThen(java.util.function.DoubleUnaryOperator)) \n\n#### public static [DoubleUnaryOperator](../../../../reference/java/util/function/DoubleUnaryOperator.html)\n**identity**\n()\n\nReturns a unary operator that always returns its input argument. \n\n##### Returns\n\n- a unary operator that always returns its input argument"]]