Stay organized with collections
Save and categorize content based on your preferences.
DoubleConsumer
public
interface
DoubleConsumer
java.util.function.DoubleConsumer
|
Known indirect subclasses
|
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
void
|
accept(double value)
Performs this operation on the given argument.
|
default
DoubleConsumer
|
andThen(DoubleConsumer after)
Returns a composed DoubleConsumer that performs, in sequence, this
operation followed by the after operation.
|
Public methods
accept
public abstract void accept (double value)
Performs this operation on the given argument.
Parameters |
value |
double : the input argument |
andThen
public DoubleConsumer andThen (DoubleConsumer after)
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 |
Returns |
DoubleConsumer |
a composed DoubleConsumer that performs in sequence this
operation followed by the after operation |
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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nDoubleConsumer\n==============\n\n\n`\npublic\n\n\ninterface\nDoubleConsumer\n`\n\n\n`\n\n\n`\n\n|-----------------------------------|\n| java.util.function.DoubleConsumer |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [DoubleStream.Builder](/reference/java/util/stream/DoubleStream.Builder), [DoubleSummaryStatistics](/reference/java/util/DoubleSummaryStatistics) |--------------------------------------------------------------------------|-------------------------------------------------------------------------------------| | [DoubleStream.Builder](/reference/java/util/stream/DoubleStream.Builder) | A mutable builder for a `DoubleStream`. | | [DoubleSummaryStatistics](/reference/java/util/DoubleSummaryStatistics) | A state object for collecting statistics such as count, min, max, sum, and average. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nRepresents an operation that accepts a single `double`-valued argument and\nreturns no result. This is the primitive type specialization of\n[Consumer](/reference/java/util/function/Consumer) for `double`. Unlike most other functional interfaces,\n`DoubleConsumer` is expected to operate via side-effects.\n\nThis is a [functional interface](/reference/java/util/function/package-summary)\nwhose functional method is [accept(double)](/reference/java/util/function/DoubleConsumer#accept(double)). \n**See also:**\n\n- [Consumer](/reference/java/util/function/Consumer)\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[accept](/reference/java/util/function/DoubleConsumer#accept(double))`(double value) ` Performs this operation on the given argument. |\n| ` default `[DoubleConsumer](/reference/java/util/function/DoubleConsumer) | ` `[andThen](/reference/java/util/function/DoubleConsumer#andThen(java.util.function.DoubleConsumer))`(`[DoubleConsumer](/reference/java/util/function/DoubleConsumer)` after) ` 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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void accept (double value)\n```\n\nPerforms this operation on the given argument.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-------------------------------------|\n| `value` | `double`: the input argument \u003cbr /\u003e |\n\n### andThen\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic DoubleConsumer andThen (DoubleConsumer after)\n```\n\nReturns a composed `DoubleConsumer` that performs, in sequence, this\noperation followed by the `after` operation. If performing either\noperation throws an exception, it is relayed to the caller of the\ncomposed operation. If performing this operation throws an exception,\nthe `after` operation will not be performed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|------------------------------------------------------------------------|\n| `after` | `DoubleConsumer`: the operation to perform after this operation \u003cbr /\u003e |\n\n| Returns ||\n|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| [DoubleConsumer](/reference/java/util/function/DoubleConsumer) | a composed `DoubleConsumer` that performs in sequence this operation followed by the `after` operation \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------|--------------------|\n| [NullPointerException](/reference/java/lang/NullPointerException) | if `after` is null |"]]