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

    Modifier and Type
    Method
    Description
    void
    add(CompletableFuture<T> completableFuture)
    This adds a CompletableFuture into the collection of results
    void
    addObject(Object object)
    This adds a new value which can be either a materialized value or a CompletableFuture
    This will return a CompletableFuture<List<T>> even if the inputs are all materialized values
    This will return a CompletableFuture<List<T>> if ANY of the input values are async otherwise it just return a materialised List<T>
  • Method Details

    • add

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

      void addObject(Object object)
      This adds a new value which can be either a materialized value or a CompletableFuture
      Parameters:
      object - the object to add
    • 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

      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