LongConsumer
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Represents an operation that accepts a single long
-valued argument and
returns no result. This is the primitive type specialization of
Consumer
for long
. Unlike most other functional interfaces,
LongConsumer
is expected to operate via side-effects.
This is a functional interface
whose functional method is accept(long)
.
Public Method Summary
abstract
void
|
accept(long value)
Performs this operation on the given argument.
|
LongConsumer
|
andThen( LongConsumer after)
Returns a composed LongConsumer that performs, in sequence, this
operation followed by the after operation.
|
Public Methods
public
abstract
void
accept
(long value)
Performs this operation on the given argument.
Returns a composed LongConsumer
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
LongConsumer
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\u003eLongConsumer\u003c/code\u003e is a functional interface representing an operation that accepts a single \u003ccode\u003elong\u003c/code\u003e value and returns no result, often used for side-effects.\u003c/p\u003e\n"],["\u003cp\u003eIt has two primary methods: \u003ccode\u003eaccept(long value)\u003c/code\u003e to perform the operation and \u003ccode\u003eandThen(LongConsumer after)\u003c/code\u003e to chain operations sequentially.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLongStream.Builder\u003c/code\u003e and \u003ccode\u003eLongSummaryStatistics\u003c/code\u003e are known indirect subclasses of this interface.\u003c/p\u003e\n"]]],[],null,["public interface **LongConsumer** \n\n|---|---|---|\n| Known Indirect Subclasses [LongStream.Builder](../../../../reference/java/util/stream/LongStream.Builder.html), [LongSummaryStatistics](../../../../reference/java/util/LongSummaryStatistics.html) |--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| | [LongStream.Builder](../../../../reference/java/util/stream/LongStream.Builder.html) | A mutable builder for a `LongStream`. | | [LongSummaryStatistics](../../../../reference/java/util/LongSummaryStatistics.html) | A state object for collecting statistics such as count, min, max, sum, and average. | |||\n\nRepresents an operation that accepts a single `long`-valued argument and\nreturns no result. This is the primitive type specialization of\n[Consumer](../../../../reference/java/util/function/Consumer.html) for `long`. Unlike most other functional interfaces,\n`LongConsumer` 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(long)](../../../../reference/java/util/function/LongConsumer.html#accept(long)). \n\nSee Also\n\n- [Consumer](../../../../reference/java/util/function/Consumer.html) \n\nPublic Method Summary\n\n|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [accept](../../../../reference/java/util/function/LongConsumer.html#accept(long))(long value) Performs this operation on the given argument. |\n| [LongConsumer](../../../../reference/java/util/function/LongConsumer.html) | [andThen](../../../../reference/java/util/function/LongConsumer.html#andThen(java.util.function.LongConsumer))([LongConsumer](../../../../reference/java/util/function/LongConsumer.html) after) Returns a composed `LongConsumer` that performs, in sequence, this operation followed by the `after` operation. |\n\nPublic Methods \n\npublic abstract void\n**accept**\n(long value) \nPerforms this operation on the given argument. \n\nParameters\n\n| value | the input argument |\n|-------|--------------------|\n\npublic [LongConsumer](../../../../reference/java/util/function/LongConsumer.html)\n**andThen**\n([LongConsumer](../../../../reference/java/util/function/LongConsumer.html) after) \nReturns a composed `LongConsumer` 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\nParameters\n\n| after | the operation to perform after this operation |\n|-------|-----------------------------------------------|\n\nReturns\n\n- a composed `LongConsumer` that performs in sequence this operation followed by the `after` operation \n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `after` is null |\n|-----------------------------------------------------------------------------------|--------------------|"]]