Stay organized with collections
Save and categorize content based on your preferences.
LongUnaryOperator
public
interface
LongUnaryOperator
java.util.function.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
.
This is a functional interface
whose functional method is applyAsLong(long)
.
Summary
Public methods
andThen
public LongUnaryOperator andThen (LongUnaryOperator after)
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 |
LongUnaryOperator : the operator to apply after this operator is applied |
Returns |
LongUnaryOperator |
a composed operator that first applies this operator and then
applies the after operator |
applyAsLong
public abstract long applyAsLong (long operand)
Applies this operator to the given operand.
Parameters |
operand |
long : the operand |
Returns |
long |
the operator result |
compose
public LongUnaryOperator compose (LongUnaryOperator before)
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 |
LongUnaryOperator : the operator to apply before this operator is applied |
Returns |
LongUnaryOperator |
a composed operator that first applies the before
operator and then applies this operator |
identity
public static LongUnaryOperator identity ()
Returns a unary operator that always returns its input argument.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# LongUnaryOperator\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nLongUnaryOperator\n=================\n\n\n`\npublic\n\n\ninterface\nLongUnaryOperator\n`\n\n\n`\n\n\n`\n\n|--------------------------------------|\n| java.util.function.LongUnaryOperator |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\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) for `long`.\n\nThis is a [functional interface](/reference/java/util/function/package-summary)\nwhose functional method is [applyAsLong(long)](/reference/java/util/function/LongUnaryOperator#applyAsLong(long)). \n**See also:**\n\n- [UnaryOperator](/reference/java/util/function/UnaryOperator)\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` default `[LongUnaryOperator](/reference/java/util/function/LongUnaryOperator) | ` `[andThen](/reference/java/util/function/LongUnaryOperator#andThen(java.util.function.LongUnaryOperator))`(`[LongUnaryOperator](/reference/java/util/function/LongUnaryOperator)` 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#applyAsLong(long))`(long operand) ` Applies this operator to the given operand. |\n| ` default `[LongUnaryOperator](/reference/java/util/function/LongUnaryOperator) | ` `[compose](/reference/java/util/function/LongUnaryOperator#compose(java.util.function.LongUnaryOperator))`(`[LongUnaryOperator](/reference/java/util/function/LongUnaryOperator)` 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) | ` `[identity](/reference/java/util/function/LongUnaryOperator#identity())`() ` Returns a unary operator that always returns its input argument. |\n\nPublic methods\n--------------\n\n### andThen\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic LongUnaryOperator andThen (LongUnaryOperator after)\n```\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\u003cbr /\u003e\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------|\n| `after` | `LongUnaryOperator`: the operator to apply after this operator is applied \u003cbr /\u003e |\n\n| Returns ||\n|----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|\n| [LongUnaryOperator](/reference/java/util/function/LongUnaryOperator) | a composed operator that first applies this operator and then applies the `after` operator \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------|------------------|\n| [NullPointerException](/reference/java/lang/NullPointerException) | if after is null |\n\n**See also:**\n\n- [compose(LongUnaryOperator)](/reference/java/util/function/LongUnaryOperator#compose(java.util.function.LongUnaryOperator)) \n\n### applyAsLong\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract long applyAsLong (long operand)\n```\n\nApplies this operator to the given operand.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|----------------------------|\n| `operand` | `long`: the operand \u003cbr /\u003e |\n\n| Returns ||\n|--------|----------------------------|\n| `long` | the operator result \u003cbr /\u003e |\n\n### compose\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic LongUnaryOperator compose (LongUnaryOperator before)\n```\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\u003cbr /\u003e\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------|\n| `before` | `LongUnaryOperator`: the operator to apply before this operator is applied \u003cbr /\u003e |\n\n| Returns ||\n|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| [LongUnaryOperator](/reference/java/util/function/LongUnaryOperator) | a composed operator that first applies the `before` operator and then applies this operator \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------|-------------------|\n| [NullPointerException](/reference/java/lang/NullPointerException) | if before is null |\n\n**See also:**\n\n- [andThen(LongUnaryOperator)](/reference/java/util/function/LongUnaryOperator#andThen(java.util.function.LongUnaryOperator)) \n\n### identity\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static LongUnaryOperator identity ()\n```\n\nReturns a unary operator that always returns its input argument.\n\n\u003cbr /\u003e\n\n| Returns ||\n|----------------------------------------------------------------------|----------------------------------------------------------------|\n| [LongUnaryOperator](/reference/java/util/function/LongUnaryOperator) | a unary operator that always returns its input argument \u003cbr /\u003e |"]]