Class Async


  • public class Async
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Async()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​U>
      java.util.concurrent.CompletableFuture<java.util.List<U>>
      each​(java.util.Collection<T> list, java.util.function.BiFunction<T,​java.lang.Integer,​java.util.concurrent.CompletableFuture<U>> cfFactory)  
      static <T,​U>
      java.util.concurrent.CompletableFuture<java.util.List<U>>
      eachSequentially​(java.lang.Iterable<T> list, Async.CFFactory<T,​U> cfFactory)  
      static <T> java.util.concurrent.CompletableFuture<T> exceptionallyCompletedFuture​(java.lang.Throwable exception)  
      static <T> Async.CombinedBuilder<T> ofExpectedSize​(int expectedSize)
      Combines 0 or more CF into one.
      static <T> java.util.concurrent.CompletableFuture<T> toCompletableFuture​(T t)
      Turns an object T into a CompletableFuture if it's not already
      static <T> java.util.concurrent.CompletableFuture<T> tryCatch​(java.util.function.Supplier<java.util.concurrent.CompletableFuture<T>> supplier)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Async

        public Async()
    • Method Detail

      • ofExpectedSize

        public static <T> Async.CombinedBuilder<T> ofExpectedSize​(int expectedSize)
        Combines 0 or more CF into one. It is a wrapper around CompletableFuture.allOf.
        Type Parameters:
        T - for two
        Parameters:
        expectedSize - how many we expect
        Returns:
        a combined builder of CFs
      • each

        public static <T,​U> java.util.concurrent.CompletableFuture<java.util.List<U>> each​(java.util.Collection<T> list,
                                                                                                 java.util.function.BiFunction<T,​java.lang.Integer,​java.util.concurrent.CompletableFuture<U>> cfFactory)
      • eachSequentially

        public static <T,​U> java.util.concurrent.CompletableFuture<java.util.List<U>> eachSequentially​(java.lang.Iterable<T> list,
                                                                                                             Async.CFFactory<T,​U> cfFactory)
      • toCompletableFuture

        public static <T> java.util.concurrent.CompletableFuture<T> toCompletableFuture​(T t)
        Turns an object T into a CompletableFuture if it's not already
        Type Parameters:
        T - for two
        Parameters:
        t - - the object to check
        Returns:
        a CompletableFuture
      • tryCatch

        public static <T> java.util.concurrent.CompletableFuture<T> tryCatch​(java.util.function.Supplier<java.util.concurrent.CompletableFuture<T>> supplier)
      • exceptionallyCompletedFuture

        public static <T> java.util.concurrent.CompletableFuture<T> exceptionallyCompletedFuture​(java.lang.Throwable exception)