Stay organized with collections
Save and categorize content based on your preferences.
IntUnaryOperator
public
interface
IntUnaryOperator
java.util.function.IntUnaryOperator
|
Represents an operation on a single int
-valued operand that produces
an int
-valued result. This is the primitive type specialization of
UnaryOperator
for int
.
This is a functional interface
whose functional method is applyAsInt(int)
.
Summary
Public methods |
default
IntUnaryOperator
|
andThen(IntUnaryOperator after)
Returns a composed operator that first applies this operator to
its input, and then applies the after operator to the result.
|
abstract
int
|
applyAsInt(int operand)
Applies this operator to the given operand.
|
default
IntUnaryOperator
|
compose(IntUnaryOperator before)
Returns a composed operator that first applies the before
operator to its input, and then applies this operator to the result.
|
static
IntUnaryOperator
|
identity()
Returns a unary operator that always returns its input argument.
|
Public methods
andThen
public IntUnaryOperator andThen (IntUnaryOperator 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 |
IntUnaryOperator : the operator to apply after this operator is applied |
Returns |
IntUnaryOperator |
a composed operator that first applies this operator and then
applies the after operator |
applyAsInt
public abstract int applyAsInt (int operand)
Applies this operator to the given operand.
Parameters |
operand |
int : the operand |
Returns |
int |
the operator result |
compose
public IntUnaryOperator compose (IntUnaryOperator 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 |
IntUnaryOperator : the operator to apply before this operator is applied |
Returns |
IntUnaryOperator |
a composed operator that first applies the before
operator and then applies this operator |
identity
public static IntUnaryOperator identity ()
Returns a unary operator that always returns its input argument.
Returns |
IntUnaryOperator |
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.
[[["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 2025-02-10 UTC."],[],[],null,["# IntUnaryOperator\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nIntUnaryOperator\n================\n\n\n`\npublic\n\n\ninterface\nIntUnaryOperator\n`\n\n\n`\n\n\n`\n\n|-------------------------------------|\n| java.util.function.IntUnaryOperator |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nRepresents an operation on a single `int`-valued operand that produces\nan `int`-valued result. This is the primitive type specialization of\n[UnaryOperator](/reference/java/util/function/UnaryOperator) for `int`.\n\nThis is a [functional interface](/reference/java/util/function/package-summary)\nwhose functional method is [applyAsInt(int)](/reference/java/util/function/IntUnaryOperator#applyAsInt(int)). \n**See also:**\n\n- [UnaryOperator](/reference/java/util/function/UnaryOperator)\n\nSummary\n-------\n\n| ### Public methods ||\n|-------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` default `[IntUnaryOperator](/reference/java/util/function/IntUnaryOperator) | ` `[andThen](/reference/java/util/function/IntUnaryOperator#andThen(java.util.function.IntUnaryOperator))`(`[IntUnaryOperator](/reference/java/util/function/IntUnaryOperator)` after) ` Returns a composed operator that first applies this operator to its input, and then applies the `after` operator to the result. |\n| ` abstract int` | ` `[applyAsInt](/reference/java/util/function/IntUnaryOperator#applyAsInt(int))`(int operand) ` Applies this operator to the given operand. |\n| ` default `[IntUnaryOperator](/reference/java/util/function/IntUnaryOperator) | ` `[compose](/reference/java/util/function/IntUnaryOperator#compose(java.util.function.IntUnaryOperator))`(`[IntUnaryOperator](/reference/java/util/function/IntUnaryOperator)` before) ` Returns a composed operator that first applies the `before` operator to its input, and then applies this operator to the result. |\n| ` static `[IntUnaryOperator](/reference/java/util/function/IntUnaryOperator) | ` `[identity](/reference/java/util/function/IntUnaryOperator#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 IntUnaryOperator andThen (IntUnaryOperator 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` | `IntUnaryOperator`: the operator to apply after this operator is applied \u003cbr /\u003e |\n\n| Returns ||\n|--------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|\n| [IntUnaryOperator](/reference/java/util/function/IntUnaryOperator) | 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(IntUnaryOperator)](/reference/java/util/function/IntUnaryOperator#compose(java.util.function.IntUnaryOperator)) \n\n### applyAsInt\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract int applyAsInt (int operand)\n```\n\nApplies this operator to the given operand.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|---------------------------|\n| `operand` | `int`: the operand \u003cbr /\u003e |\n\n| Returns ||\n|-------|----------------------------|\n| `int` | the operator result \u003cbr /\u003e |\n\n### compose\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic IntUnaryOperator compose (IntUnaryOperator 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` | `IntUnaryOperator`: the operator to apply before this operator is applied \u003cbr /\u003e |\n\n| Returns ||\n|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| [IntUnaryOperator](/reference/java/util/function/IntUnaryOperator) | 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(IntUnaryOperator)](/reference/java/util/function/IntUnaryOperator#andThen(java.util.function.IntUnaryOperator)) \n\n### identity\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static IntUnaryOperator identity ()\n```\n\nReturns a unary operator that always returns its input argument.\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------------------------------------------------------------|----------------------------------------------------------------|\n| [IntUnaryOperator](/reference/java/util/function/IntUnaryOperator) | a unary operator that always returns its input argument \u003cbr /\u003e |"]]