Uses of Interface java.util.function.BiConsumer (Java Platform SE 8 )
Date: 2026-03-16

## Uses of Interface
java.util.function.BiConsumer

- Packages that use BiConsumer
  Package | Description
  --- | ---
  java.security | Provides the classes and interfaces for the security framework.
  java.util | Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
  java.util.concurrent | Utility classes commonly useful in concurrent programming.
  java.util.function | Functional interfaces provide target types for lambda expressions and method references.
  java.util.stream | Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.

- - ### Uses of BiConsumer in java.security

    Methods in java.security with parameters of type BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `void` | Provider.`forEach(BiConsumer<? super Object,? super Object> action)`

  - ### Uses of BiConsumer in java.util

    Methods in java.util with parameters of type BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `void` | LinkedHashMap.`forEach(BiConsumer<? super K,? super V> action)`
    `void` | WeakHashMap.`forEach(BiConsumer<? super K,? super V> action)`
    `void` | Hashtable.`forEach(BiConsumer<? super K,? super V> action)`
    `void` | HashMap.`forEach(BiConsumer<? super K,? super V> action)`
    `void` | TreeMap.`forEach(BiConsumer<? super K,? super V> action)`
    `default void` | Map.`forEach(BiConsumer<? super K,? super V> action)` Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
    `void` | IdentityHashMap.`forEach(BiConsumer<? super K,? super V> action)`

  - ### Uses of BiConsumer in java.util.concurrent

    Methods in java.util.concurrent with parameters of type BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `void` | ConcurrentSkipListMap.`forEach(BiConsumer<? super K,? super V> action)`
    `default void` | ConcurrentMap.`forEach(BiConsumer<? super K,? super V> action)` Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
    `void` | ConcurrentHashMap.`forEach(BiConsumer<? super K,? super V> action)`
    `void` | ConcurrentHashMap.`forEach(long parallelismThreshold, BiConsumer<? super K,? super V> action)` Performs the given action for each (key, value).
    `<U> CompletableFuture<Void>` | CompletableFuture.`thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)`
    `<U> CompletionStage<Void>` | CompletionStage.`thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)` Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied action.
    `<U> CompletableFuture<Void>` | CompletableFuture.`thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)`
    `<U> CompletionStage<Void>` | CompletionStage.`thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)` Returns a new CompletionStage that, when this and the other given stage complete normally, is executed using this stage's default asynchronous execution facility, with the two results as arguments to the supplied action.
    `<U> CompletableFuture<Void>` | CompletableFuture.`thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)`
    `<U> CompletionStage<Void>` | CompletionStage.`thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)` Returns a new CompletionStage that, when this and the other given stage complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function.
    `CompletableFuture<T>` | CompletableFuture.`whenComplete(BiConsumer<? super T,? super Throwable> action)`
    `CompletionStage<T>` | CompletionStage.`whenComplete(BiConsumer<? super T,? super Throwable> action)` Returns a new CompletionStage with the same result or exception as this stage, that executes the given action when this stage completes.
    `CompletableFuture<T>` | CompletableFuture.`whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)`
    `CompletionStage<T>` | CompletionStage.`whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)` Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using this stage's default asynchronous execution facility when this stage completes.
    `CompletableFuture<T>` | CompletableFuture.`whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)`
    `CompletionStage<T>` | CompletionStage.`whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)` Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes.

  - ### Uses of BiConsumer in java.util.function

    Methods in java.util.function that return BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `default BiConsumer<T,U>` | BiConsumer.`andThen(BiConsumer<? super T,? super U> after)` Returns a composed `BiConsumer` that performs, in sequence, this operation followed by the `after` operation.

    Methods in java.util.function with parameters of type BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `default BiConsumer<T,U>` | BiConsumer.`andThen(BiConsumer<? super T,? super U> after)` Returns a composed `BiConsumer` that performs, in sequence, this operation followed by the `after` operation.

  - ### Uses of BiConsumer in java.util.stream

    Methods in java.util.stream that return BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `BiConsumer<A,T>` | Collector.`accumulator()` A function that folds a value into a mutable result container.

    Methods in java.util.stream with parameters of type BiConsumer
    Modifier and Type | Method and Description
    --- | ---
    `<R> R` | Stream.`collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)` Performs a mutable reduction operation on the elements of this stream.
    `<R> R` | Stream.`collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)` Performs a mutable reduction operation on the elements of this stream.
    `<R> R` | DoubleStream.`collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R,R> combiner)` Performs a mutable reduction operation on the elements of this stream.
    `<R> R` | IntStream.`collect(Supplier<R> supplier, ObjIntConsumer<R> accumulator, BiConsumer<R,R> combiner)` Performs a mutable reduction operation on the elements of this stream.
    `<R> R` | LongStream.`collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R,R> combiner)` Performs a mutable reduction operation on the elements of this stream.
    `static <T,A,R> Collector<T,A,R>` | Collector.`of(Supplier<A> supplier, BiConsumer<A,T> accumulator, BinaryOperator<A> combiner, Function<A,R> finisher, Collector.Characteristics... characteristics)` Returns a new `Collector` described by the given `supplier`, `accumulator`, `combiner`, and `finisher` functions.
    `static <T,R> Collector<T,R,R>` | Collector.`of(Supplier<R> supplier, BiConsumer<R,T> accumulator, BinaryOperator<R> combiner, Collector.Characteristics... characteristics)` Returns a new `Collector` described by the given `supplier`, `accumulator`, and `combiner` functions.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.