Stay organized with collections
Save and categorize content based on your preferences.
IntConsumer
@FunctionalInterface interface IntConsumer
Represents an operation that accepts a single int
-valued argument and returns no result. This is the primitive type specialization of Consumer
for int
. Unlike most other functional interfaces, IntConsumer
is expected to operate via side-effects.
This is a functional interface whose functional method is accept(int)
.
Summary
Public methods |
abstract Unit |
Performs this operation on the given argument.
|
open IntConsumer! |
Returns a composed IntConsumer that performs, in sequence, this operation followed by the after operation.
|
Public methods
accept
abstract fun accept(value: Int): Unit
Performs this operation on the given argument.
Parameters |
value |
Int: the input argument |
andThen
open fun andThen(after: IntConsumer!): IntConsumer!
Returns a composed IntConsumer
that performs, in sequence, this operation followed by the after
operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the after
operation will not be performed.
Parameters |
after |
IntConsumer!: the operation to perform after this operation |
Return |
IntConsumer! |
a composed IntConsumer that performs in sequence this operation followed by the after operation |
Exceptions |
java.lang.NullPointerException |
if after is null |
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,["# IntConsumer\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nIntConsumer\n===========\n\n```\n@FunctionalInterface interface IntConsumer\n```\n\n|-------------------------------------|\n| [java.util.function.IntConsumer](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [IntStream.Builder](../stream/IntStream.Builder.html#), [IntSummaryStatistics](../IntSummaryStatistics.html#), [LongSummaryStatistics](../LongSummaryStatistics.html#) |---------------------------------------------------------|-------------------------------------------------------------------------------------| | [IntStream.Builder](../stream/IntStream.Builder.html#) | A mutable builder for an `IntStream`. | | [IntSummaryStatistics](../IntSummaryStatistics.html#) | A state object for collecting statistics such as count, min, max, sum, and average. | | [LongSummaryStatistics](../LongSummaryStatistics.html#) | A state object for collecting statistics such as count, min, max, sum, and average. | |\n\nRepresents an operation that accepts a single `int`-valued argument and returns no result. This is the primitive type specialization of [Consumer](/reference/kotlin/java/util/function/Consumer) for `int`. Unlike most other functional interfaces, `IntConsumer` is expected to operate via side-effects.\n\nThis is a [functional interface](/reference/kotlin/java/util/function/package-summary) whose functional method is [accept(int)](#accept(kotlin.Int)).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [accept](#accept(kotlin.Int))`(`value:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Performs this operation on the given argument. |\n| open [IntConsumer](#)! | [andThen](#andThen(java.util.function.IntConsumer))`(`after:` `[IntConsumer](#)!`)` Returns a composed `IntConsumer` that performs, in sequence, this operation followed by the `after` operation. |\n\nPublic methods\n--------------\n\n### accept\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun accept(value: Int): Unit\n```\n\nPerforms this operation on the given argument.\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------|\n| `value` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the input argument |\n\n### andThen\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun andThen(after: IntConsumer!): IntConsumer!\n```\n\nReturns a composed `IntConsumer` that performs, in sequence, this operation followed by the `after` operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the `after` operation will not be performed.\n\n| Parameters ||\n|---------|------------------------------------------------------------------|\n| `after` | [IntConsumer](#)!: the operation to perform after this operation |\n\n| Return ||\n|-------------------|-----------------------------------------------------------------------------------------------------|\n| [IntConsumer](#)! | a composed `IntConsumer` that performs in sequence this operation followed by the `after` operation |\n\n| Exceptions ||\n|----------------------------------|--------------------|\n| `java.lang.NullPointerException` | if `after` is null |"]]