Uses of Interface
java.util.function.Consumer
Packages that use Consumer
Package
Description
Provides a simple high-level Http server API, which can be used to build
embedded HTTP servers.
Provides classes that are fundamental to the design of the Java
programming language.
Provides low-level access to memory and functions outside the Java runtime.
HTTP Client and WebSocket APIs
Defines channels, which represent connections to entities that are capable of
performing I/O operations, such as files and sockets; defines selectors, for
multiplexed, non-blocking I/O operations.
Contains the collections framework, some internationalization support classes,
a service loader, properties, random number generation, string parsing
and scanning classes, base64 encoding and decoding, a bit array, and
several miscellaneous utility classes.
Utility classes commonly useful in concurrent programming.
Functional interfaces provide target types for lambda expressions
and method references.
Classes to support functional-style operations on streams of elements, such
as map-reduce transformations on collections.
This package contains classes for consuming Flight Recorder data.
Provides interfaces for creating tools, such as a Read-Eval-Print Loop (REPL),
which interactively evaluate "snippets" of Java programming language code.
Provides implementation support for building JShell execution engines.
This package contains classes to control and monitor Flight Recorder over Java Management Extensions (JMX).
-
Uses of Consumer in com.sun.net.httpserver
Methods in com.sun.net.httpserver with parameters of type ConsumerModifier and TypeMethodDescriptionstatic FilterFilter.afterHandler(String description, Consumer<HttpExchange> operation) Returns a post-processingFilterwith the given description and operation.static FilterFilter.beforeHandler(String description, Consumer<HttpExchange> operation) Returns a pre-processingFilterwith the given description and operation. -
Uses of Consumer in java.lang
Modifier and TypeMethodDescriptiondefault voidPerforms the given action for each element of theIterableuntil all elements have been processed or the action throws an exception.voidStackWalker.forEach(Consumer<? super StackWalker.StackFrame> action) Performs the given action on each element ofStackFramestream of the current thread, traversing from the top frame of the stack, which is the method calling thisforEachmethod. -
Uses of Consumer in java.lang.foreign
Methods in java.lang.foreign with parameters of type ConsumerModifier and TypeMethodDescriptionMemorySegment.reinterpret(long newSize, ArenaPREVIEW arena, Consumer<MemorySegmentPREVIEW> cleanup) Returns a new segment with the same address as this segment, but with the provided size and scope.MemorySegment.reinterpret(ArenaPREVIEW arena, Consumer<MemorySegmentPREVIEW> cleanup) Returns a new memory segment with the same address and size as this segment, but with the provided scope. -
Uses of Consumer in java.net.http
Methods in java.net.http with parameters of type ConsumerModifier and TypeMethodDescriptionstatic HttpResponse.BodyHandler<Void> HttpResponse.BodyHandlers.ofByteArrayConsumer(Consumer<Optional<byte[]>> consumer) Returns aBodyHandler<Void>that returns aBodySubscriber<Void>obtained fromBodySubscribers.ofByteArrayConsumer(Consumer).static HttpResponse.BodySubscriber<Void> HttpResponse.BodySubscribers.ofByteArrayConsumer(Consumer<Optional<byte[]>> consumer) Returns aBodySubscriberwhich provides the incoming body data to the provided Consumer ofOptional<byte[]>. -
Uses of Consumer in java.nio.channels
Methods in java.nio.channels with parameters of type ConsumerModifier and TypeMethodDescriptionintSelector.select(Consumer<SelectionKey> action) Selects and performs an action on the keys whose corresponding channels are ready for I/O operations.intSelector.select(Consumer<SelectionKey> action, long timeout) Selects and performs an action on the keys whose corresponding channels are ready for I/O operations.intSelector.selectNow(Consumer<SelectionKey> action) Selects and performs an action on the keys whose corresponding channels are ready for I/O operations. -
Uses of Consumer in java.util
Modifier and TypeMethodDescriptionvoidvoidvoidvoiddefault voidIterator.forEachRemaining(Consumer<? super E> action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.default voidPrimitiveIterator.OfDouble.forEachRemaining(Consumer<? super Double> action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.default voidPrimitiveIterator.OfInt.forEachRemaining(Consumer<? super Integer> action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.default voidPrimitiveIterator.OfLong.forEachRemaining(Consumer<? super Long> action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.default voidSpliterator.forEachRemaining(Consumer<? super T> action) Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.default voidSpliterator.OfDouble.forEachRemaining(Consumer<? super Double> action) Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.default voidSpliterator.OfInt.forEachRemaining(Consumer<? super Integer> action) Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.default voidSpliterator.OfLong.forEachRemaining(Consumer<? super Long> action) Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.voidIf a value is present, performs the given action with the value, otherwise does nothing.voidOptional.ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction) If a value is present, performs the given action with the value, otherwise performs the given empty-based action.default booleanSpliterator.OfDouble.tryAdvance(Consumer<? super Double> action) If a remaining element exists: performs the given action on it, returningtrue; else returnsfalse.default booleanSpliterator.OfInt.tryAdvance(Consumer<? super Integer> action) If a remaining element exists: performs the given action on it, returningtrue; else returnsfalse.default booleanSpliterator.OfLong.tryAdvance(Consumer<? super Long> action) If a remaining element exists: performs the given action on it, returningtrue; else returnsfalse.booleanSpliterator.tryAdvance(Consumer<? super T> action) If a remaining element exists: performs the given action on it, returningtrue; else returnsfalse. -
Uses of Consumer in java.util.concurrent
Methods in java.util.concurrent with parameters of type ConsumerModifier and TypeMethodDescriptionCompletableFuture.acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) CompletionStage.acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action.CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied action.CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action.Processes all published items using the given Consumer function.void<U> voidConcurrentHashMap.forEach(long parallelismThreshold, BiFunction<? super K, ? super V, ? extends U> transformer, Consumer<? super U> action) Performs the given action for each non-null transformation of each (key, value).voidvoidvoidvoidvoidvoidvoidvoidvoidConcurrentHashMap.forEachEntry(long parallelismThreshold, Consumer<? super Map.Entry<K, V>> action) Performs the given action for each entry.<U> voidConcurrentHashMap.forEachEntry(long parallelismThreshold, Function<Map.Entry<K, V>, ? extends U> transformer, Consumer<? super U> action) Performs the given action for each non-null transformation of each entry.voidConcurrentHashMap.forEachKey(long parallelismThreshold, Consumer<? super K> action) Performs the given action for each key.<U> voidConcurrentHashMap.forEachKey(long parallelismThreshold, Function<? super K, ? extends U> transformer, Consumer<? super U> action) Performs the given action for each non-null transformation of each key.voidConcurrentHashMap.forEachValue(long parallelismThreshold, Consumer<? super V> action) Performs the given action for each value.<U> voidConcurrentHashMap.forEachValue(long parallelismThreshold, Function<? super V, ? extends U> transformer, Consumer<? super U> action) Performs the given action for each non-null transformation of each value.CompletableFuture.thenAccept(Consumer<? super T> action) CompletionStage.thenAccept(Consumer<? super T> action) Returns a new CompletionStage that, when this stage completes normally, is executed with this stage's result as the argument to the supplied action.CompletableFuture.thenAcceptAsync(Consumer<? super T> action) CompletableFuture.thenAcceptAsync(Consumer<? super T> action, Executor executor) CompletionStage.thenAcceptAsync(Consumer<? super T> action) Returns a new CompletionStage that, when this stage completes normally, is executed using this stage's default asynchronous execution facility, with this stage's result as the argument to the supplied action.CompletionStage.thenAcceptAsync(Consumer<? super T> action, Executor executor) Returns a new CompletionStage that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied action. -
Uses of Consumer in java.util.function
Methods in java.util.function that return ConsumerModifier and TypeMethodDescriptionReturns a composedConsumerthat performs, in sequence, this operation followed by theafteroperation.Methods in java.util.function with parameters of type Consumer -
Uses of Consumer in java.util.stream
Subinterfaces of Consumer in java.util.streamModifier and TypeInterfaceDescriptionstatic interfaceA mutable builder for aStream.Methods in java.util.stream with parameters of type ConsumerModifier and TypeMethodDescriptionvoidPerforms an action for each element of this stream.voidStream.forEachOrdered(Consumer<? super T> action) Performs an action for each element of this stream, in the encounter order of the stream if the stream has a defined encounter order.Returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream.Method parameters in java.util.stream with type arguments of type ConsumerModifier and TypeMethodDescriptiondefault <R> Stream<R> Stream.mapMulti(BiConsumer<? super T, ? super Consumer<R>> mapper) Returns a stream consisting of the results of replacing each element of this stream with multiple elements, specifically zero or more elements. -
Uses of Consumer in jdk.jfr.consumer
Methods in jdk.jfr.consumer with parameters of type ConsumerModifier and TypeMethodDescriptionvoidRegisters an action to perform if an exception occurs.voidvoidEventStream.onEvent(String eventName, Consumer<RecordedEvent> action) Registers an action to perform on all events matching a name.voidEventStream.onEvent(Consumer<RecordedEvent> action) Registers an action to perform on all events in the stream.voidRecordingStream.onEvent(String eventName, Consumer<RecordedEvent> action) voidRecordingStream.onEvent(Consumer<RecordedEvent> action) default voidEventStream.onMetadata(Consumer<MetadataEvent> action) Registers an action to perform when new metadata arrives in the stream. -
Uses of Consumer in jdk.jshell
Methods in jdk.jshell with parameters of type ConsumerModifier and TypeMethodDescriptionJShell.onShutdown(Consumer<JShell> listener) Register a callback to be called when this JShell instance terminates.JShell.onSnippetEvent(Consumer<SnippetEvent> listener) Register a callback to be called when the Status of a snippet changes. -
Uses of Consumer in jdk.jshell.execution
Methods in jdk.jshell.execution with parameters of type ConsumerModifier and TypeMethodDescriptionstatic voidUtil.detectJdiExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) Monitor the JDI event stream forVMDeathEventandVMDisconnectEvent.Method parameters in jdk.jshell.execution with type arguments of type ConsumerModifier and TypeMethodDescriptionstatic voidUtil.forwardExecutionControlAndIO(ExecutionControl ec, InputStream inStream, OutputStream outStream, Map<String, Consumer<OutputStream>> outputStreamMap, Map<String, Consumer<InputStream>> inputStreamMap) Forward commands from the input to the specifiedExecutionControlinstance, then responses back on the output. -
Uses of Consumer in jdk.management.jfr
Methods in jdk.management.jfr with parameters of type ConsumerModifier and TypeMethodDescriptionvoidvoidRemoteRecordingStream.onEvent(String eventName, Consumer<RecordedEvent> action) voidRemoteRecordingStream.onEvent(Consumer<RecordedEvent> action)