LongUnaryOperator
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
long
applyAsLong
(long 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\u003eLongUnaryOperator\u003c/code\u003e is a functional interface representing an operation on a single \u003ccode\u003elong\u003c/code\u003e input that produces a \u003ccode\u003elong\u003c/code\u003e output.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods like \u003ccode\u003eapplyAsLong\u003c/code\u003e to apply the operation, \u003ccode\u003eandThen\u003c/code\u003e to chain operations sequentially, and \u003ccode\u003ecompose\u003c/code\u003e to chain operations in reverse order.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eidentity\u003c/code\u003e is a static method that returns an operator which returns its input unchanged.\u003c/p\u003e\n"]]],["`LongUnaryOperator` is a functional interface for operations on a single `long` value, producing a `long` result. Key actions include: `applyAsLong(long operand)` to apply the operation, `andThen(LongUnaryOperator after)` to chain operations sequentially, and `compose(LongUnaryOperator before)` to apply another operator before the current one. `identity()` method returns a `LongUnaryOperator` that returns the input. `andThen` and `compose` can throw a `NullPointerException`.\n"],null,["public interface **LongUnaryOperator** \nRepresents an operation on a single `long`-valued operand that produces\na `long`-valued result. This is the primitive type specialization of\n[UnaryOperator](../../../../reference/java/util/function/UnaryOperator.html) for `long`.\n\nThis is a [functional interface](/j2objc/javadoc/jre/reference/java/util/function/package-summary)\nwhose functional method is [applyAsLong(long)](../../../../reference/java/util/function/LongUnaryOperator.html#applyAsLong(long)). \n\nSee Also\n\n- [UnaryOperator](../../../../reference/java/util/function/UnaryOperator.html) \n\nPublic Method Summary\n\n|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html) | [andThen](../../../../reference/java/util/function/LongUnaryOperator.html#andThen(java.util.function.LongUnaryOperator))([LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.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 long | [applyAsLong](../../../../reference/java/util/function/LongUnaryOperator.html#applyAsLong(long))(long operand) Applies this operator to the given operand. |\n| [LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html) | [compose](../../../../reference/java/util/function/LongUnaryOperator.html#compose(java.util.function.LongUnaryOperator))([LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.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 [LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html) | [identity](../../../../reference/java/util/function/LongUnaryOperator.html#identity())() Returns a unary operator that always returns its input argument. |\n\nPublic Methods \n\npublic [LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html)\n**andThen**\n([LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html) after) \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\nParameters\n\n| after | the operator to apply after this operator is applied |\n|-------|------------------------------------------------------|\n\nReturns\n\n- a composed operator that first applies this operator and then applies the `after` operator \n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if after is null |\n|-----------------------------------------------------------------------------------|------------------|\n\nSee Also\n\n- [compose(LongUnaryOperator)](../../../../reference/java/util/function/LongUnaryOperator.html#compose(java.util.function.LongUnaryOperator)) \n\npublic abstract long\n**applyAsLong**\n(long operand) \nApplies this operator to the given operand. \n\nParameters\n\n| operand | the operand |\n|---------|-------------|\n\nReturns\n\n- the operator result \n\npublic [LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html)\n**compose**\n([LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html) before) \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\nParameters\n\n| before | the operator to apply before this operator is applied |\n|--------|-------------------------------------------------------|\n\nReturns\n\n- a composed operator that first applies the `before` operator and then applies this operator \n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if before is null |\n|-----------------------------------------------------------------------------------|-------------------|\n\nSee Also\n\n- [andThen(LongUnaryOperator)](../../../../reference/java/util/function/LongUnaryOperator.html#andThen(java.util.function.LongUnaryOperator)) \n\npublic static [LongUnaryOperator](../../../../reference/java/util/function/LongUnaryOperator.html)\n**identity**\n() \nReturns a unary operator that always returns its input argument. \n\nReturns\n\n- a unary operator that always returns its input argument"]]