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