Class Futures

java.lang.Object
io.atomix.client.utils.concurrent.Futures

public class Futures extends Object
  • Constructor Details

    • Futures

      public Futures()
  • Method Details

    • allOf

      public static <T> CompletableFuture<Stream<T>> allOf(Stream<CompletableFuture<T>> futures)
      Returns a new CompletableFuture completed with a list of computed values when all of the given CompletableFuture complete.
      Type Parameters:
      T - value type of CompletableFuture
      Parameters:
      futures - the CompletableFutures
      Returns:
      a new CompletableFuture that is completed when all of the given CompletableFutures complete
    • allOf

      public static <T> CompletableFuture<List<T>> allOf(List<CompletableFuture<T>> futures)
      Returns a new CompletableFuture completed with a list of computed values when all of the given CompletableFuture complete.
      Type Parameters:
      T - value type of CompletableFuture
      Parameters:
      futures - the CompletableFutures
      Returns:
      a new CompletableFuture that is completed when all of the given CompletableFutures complete
    • allOf

      public static <T> CompletableFuture<T> allOf(List<CompletableFuture<T>> futures, BinaryOperator<T> reducer, T emptyValue)
      Returns a new CompletableFuture completed by reducing a list of computed values when all of the given CompletableFuture complete.
      Type Parameters:
      T - value type of CompletableFuture
      Parameters:
      futures - the CompletableFutures
      reducer - reducer for computing the result
      emptyValue - zero value to be returned if the input future list is empty
      Returns:
      a new CompletableFuture that is completed when all of the given CompletableFutures complete