DoubleConsumer
Stay organized with collections
Save and categorize content based on your preferences.
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)
.
Public Method Summary
abstract
void
|
accept(double value)
Performs this operation on the given argument.
|
DoubleConsumer
|
andThen( DoubleConsumer after)
Returns a composed DoubleConsumer that performs, in sequence, this
operation followed by the after operation.
|
Public Methods
public
abstract
void
accept
(double value)
Performs this operation on the given argument.
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 |
the operation to perform after this operation |
Returns
- a composed
DoubleConsumer
that performs in sequence this
operation followed by the after
operation
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-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 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eDoubleConsumer\u003c/code\u003e is a functional interface representing an operation that accepts a single \u003ccode\u003edouble\u003c/code\u003e and returns no result, primarily designed for side-effects.\u003c/p\u003e\n"],["\u003cp\u003eIt is a specialization of the \u003ccode\u003eConsumer\u003c/code\u003e interface for primitive \u003ccode\u003edouble\u003c/code\u003e values.\u003c/p\u003e\n"],["\u003cp\u003eKey methods include \u003ccode\u003eaccept(double)\u003c/code\u003e to perform the operation and \u003ccode\u003eandThen(DoubleConsumer)\u003c/code\u003e to chain multiple operations sequentially.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDoubleStream.Builder\u003c/code\u003e and \u003ccode\u003eDoubleSummaryStatistics\u003c/code\u003e are known indirect subclasses of \u003ccode\u003eDoubleConsumer\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# DoubleConsumer\n\npublic interface **DoubleConsumer** \n\n|---|---|---|\n| Known Indirect Subclasses [DoubleStream.Builder](../../../../reference/java/util/stream/DoubleStream.Builder.html), [DoubleSummaryStatistics](../../../../reference/java/util/DoubleSummaryStatistics.html) |------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| | [DoubleStream.Builder](../../../../reference/java/util/stream/DoubleStream.Builder.html) | A mutable builder for a `DoubleStream`. | | [DoubleSummaryStatistics](../../../../reference/java/util/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\nreturns no result. This is the primitive type specialization of\n[Consumer](../../../../reference/java/util/function/Consumer.html) for `double`. Unlike most other functional interfaces,\n`DoubleConsumer` is expected to operate via side-effects.\n\nThis is a [functional interface](/j2objc/javadoc/jre/reference/java/util/function/package-summary)\nwhose functional method is [accept(double)](../../../../reference/java/util/function/DoubleConsumer.html#accept(double)). \n\n##### See Also\n\n- [Consumer](../../../../reference/java/util/function/Consumer.html) \n\n### Public Method Summary\n\n|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [accept](../../../../reference/java/util/function/DoubleConsumer.html#accept(double))(double value) Performs this operation on the given argument. |\n| [DoubleConsumer](../../../../reference/java/util/function/DoubleConsumer.html) | [andThen](../../../../reference/java/util/function/DoubleConsumer.html#andThen(java.util.function.DoubleConsumer))([DoubleConsumer](../../../../reference/java/util/function/DoubleConsumer.html) after) Returns a composed `DoubleConsumer` that performs, in sequence, this operation followed by the `after` operation. |\n\nPublic Methods\n--------------\n\n#### public abstract void\n**accept**\n(double value)\n\nPerforms this operation on the given argument. \n\n##### Parameters\n\n| value | the input argument |\n|-------|--------------------|\n\n#### public [DoubleConsumer](../../../../reference/java/util/function/DoubleConsumer.html)\n**andThen**\n([DoubleConsumer](../../../../reference/java/util/function/DoubleConsumer.html) after)\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##### Parameters\n\n| after | the operation to perform after this operation |\n|-------|-----------------------------------------------|\n\n##### Returns\n\n- a composed `DoubleConsumer` that performs in sequence this operation followed by the `after` operation \n\n##### Throws\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `after` is null |\n|-----------------------------------------------------------------------------------|--------------------|"]]