Interface Async.CombinedBuilder<T>

  • Type Parameters:
    T - for two
    Enclosing class:
    Async

    public static interface Async.CombinedBuilder<T>
    A builder of materialized objects or CompletableFutures than can present a promise to the list of them

    This builder has a strict contract on size whereby if the expectedSize is five, then there MUST be five elements presented to it.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(java.util.concurrent.CompletableFuture<T> completableFuture)
      This adds a CompletableFuture into the collection of results
      void addObject​(java.lang.Object object)
      This adds a new value which can be either a materialized value or a CompletableFuture
      java.util.concurrent.CompletableFuture<java.util.List<T>> await()
      This will return a CompletableFuture<List<T>> even if the inputs are all materialized values
      java.lang.Object awaitPolymorphic()
      This will return a CompletableFuture<List<T>> if ANY of the input values are async otherwise it just return a materialised List<T>
    • Method Detail

      • add

        void add​(java.util.concurrent.CompletableFuture<T> completableFuture)
        This adds a CompletableFuture into the collection of results
        Parameters:
        completableFuture - the CF to add
      • addObject

        void addObject​(java.lang.Object object)
        This adds a new value which can be either a materialized value or a CompletableFuture
        Parameters:
        object - the object to add
      • await

        java.util.concurrent.CompletableFuture<java.util.List<T>> await()
        This will return a CompletableFuture<List<T>> even if the inputs are all materialized values
        Returns:
        a CompletableFuture to a List of values
      • awaitPolymorphic

        java.lang.Object awaitPolymorphic()
        This will return a CompletableFuture<List<T>> if ANY of the input values are async otherwise it just return a materialised List<T>
        Returns:
        either a CompletableFuture or a materialized list