IntConsumer
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
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)
.
Public Method Summary
abstract
void
|
accept(int value)
Performs this operation on the given argument.
|
IntConsumer
|
andThen( IntConsumer after)
Returns a composed IntConsumer that performs, in sequence, this
operation followed by the after operation.
|
Public Methods
public
abstract
void
accept
(int value)
Performs this operation on the given argument.
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 |
the operation to perform after this operation |
Returns
- a composed
IntConsumer
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\u003eIntConsumer\u003c/code\u003e represents an operation that accepts a single integer and returns no result, primarily designed for side-effects.\u003c/p\u003e\n"],["\u003cp\u003eIt is a functional interface with a primary method \u003ccode\u003eaccept(int)\u003c/code\u003e to perform the operation on the given integer.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIntConsumer\u003c/code\u003e provides the \u003ccode\u003eandThen\u003c/code\u003e method to combine operations sequentially, enabling chaining of actions.\u003c/p\u003e\n"],["\u003cp\u003eSubclasses like \u003ccode\u003eIntStream.Builder\u003c/code\u003e and \u003ccode\u003eIntSummaryStatistics\u003c/code\u003e utilize \u003ccode\u003eIntConsumer\u003c/code\u003e for building streams or collecting statistics.\u003c/p\u003e\n"]]],[],null,["# IntConsumer\n\npublic interface **IntConsumer** \n\n|---|---|---|\n| Known Indirect Subclasses [IntStream.Builder](../../../../reference/java/util/stream/IntStream.Builder.html), [IntSummaryStatistics](../../../../reference/java/util/IntSummaryStatistics.html), [LongSummaryStatistics](../../../../reference/java/util/LongSummaryStatistics.html) |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| | [IntStream.Builder](../../../../reference/java/util/stream/IntStream.Builder.html) | A mutable builder for an `IntStream`. | | [IntSummaryStatistics](../../../../reference/java/util/IntSummaryStatistics.html) | A state object for collecting statistics such as count, min, max, sum, and average. | | [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 `int`-valued argument and\nreturns no result. This is the primitive type specialization of\n[Consumer](../../../../reference/java/util/function/Consumer.html) for `int`. Unlike most other functional interfaces,\n`IntConsumer` 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(int)](../../../../reference/java/util/function/IntConsumer.html#accept(int)). \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/IntConsumer.html#accept(int))(int value) Performs this operation on the given argument. |\n| [IntConsumer](../../../../reference/java/util/function/IntConsumer.html) | [andThen](../../../../reference/java/util/function/IntConsumer.html#andThen(java.util.function.IntConsumer))([IntConsumer](../../../../reference/java/util/function/IntConsumer.html) after) Returns a composed `IntConsumer` that performs, in sequence, this operation followed by the `after` operation. |\n\nPublic Methods\n--------------\n\n#### public abstract void\n**accept**\n(int value)\n\nPerforms this operation on the given argument. \n\n##### Parameters\n\n| value | the input argument |\n|-------|--------------------|\n\n#### public [IntConsumer](../../../../reference/java/util/function/IntConsumer.html)\n**andThen**\n([IntConsumer](../../../../reference/java/util/function/IntConsumer.html) after)\n\nReturns a composed `IntConsumer` 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 `IntConsumer` 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|-----------------------------------------------------------------------------------|--------------------|"]]