Class CompletableFutureUtils

java.lang.Object
io.camunda.zeebe.backup.s3.util.CompletableFutureUtils

public final class CompletableFutureUtils extends Object
  • Method Details

    • mapAsync

      public static <K, V> CompletableFuture<Map<K,V>> mapAsync(Collection<K> keys, Function<K,CompletableFuture<V>> valueMapper)
      Maps keys to values by applying a mapping function asynchronously.
      Type Parameters:
      V - Type of value
      Parameters:
      keys - A collection of keys.
      valueMapper - A function that returns a CompletableFuture<V> for every key.
      Returns:
      A future that completes with a map of keys to the completed result of applying the mapping function. If the mapping function completes exceptionally, the resulting future will also complete exceptionally. @ param Type of keys
    • mapAsync

      public static <C, K, V> CompletableFuture<Map<K,V>> mapAsync(Collection<C> coll, Function<C,K> keyMapper, Function<C,CompletableFuture<V>> valueMapper)
      Maps keys to values by applying a mapping function asynchronously.
      Type Parameters:
      V - Type of value
      Parameters:
      coll - A collection where elements will be mapped to keys and value by the provided functions.
      valueMapper - A function that returns a CompletableFuture<V> for every key.
      Returns:
      A future that completes with a map of keys to the completed result of applying the mapping function. If the mapping function completes exceptionally, the resulting future will also complete exceptionally. @ param Type of keys