Package: grails.async

## [Groovy] Class PromiseList<T>

- grails.async.PromiseList

- All Implemented Interfaces and Traits:
    Promise

      @groovy.transform.CompileStatic
      class PromiseList
      extends java.lang.Object

  A list of promises

  Authors:
    Graeme Rocher
  Since:
    2.3

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected java.util.List<T>` | `initialized` |
    `protected java.util.List<Promise>` | `promises` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Promise<java.util.List<T>>` | `accept(java.util.List<T> value)`
    `` | `boolean` | `add(java.lang.Object value)` Implementation of add that adds any value as a bound promise
    `` | `boolean` | `add(groovy.lang.Closure callable)` Implementation of add that takes a closure and creates a promise, adding it to the list
    `` | `boolean` | `add(Promise<T> p)` Implementation of add that takes a promise, adding it to the list
    `` | `boolean` | `cancel(boolean mayInterruptIfRunning)` Synchronously obtains all the values from all the promises
    `` | `java.util.List` | `get()`
    `` | `java.util.List` | `get(long timeout, java.util.concurrent.TimeUnit units)`
    `` | `boolean` | `isCancelled()`
    `` | `boolean` | `isDone()`
    `` | `PromiseList` | `leftShift(groovy.lang.Closure callable)` Add a promise to the promise list
    `` | `PromiseList` | `leftShift(java.lang.Object value)` Add a value as a bound promise to the list of values
    `` | `PromiseList` | `leftShift(Promise p)` Add a promise to the promise list
    `` | `Promise` | `onComplete(groovy.lang.Closure callable)` Execute the given closure when all promises are complete
    `` | `Promise` | `onError(groovy.lang.Closure callable)`
    `` | `Promise` | `then(groovy.lang.Closure callable)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### protected java.util.List<T> initialized

    - #### protected java.util.List<Promise> promises

  - ### Method Detail

    - #### @java.lang.Override Promise<java.util.List<T>> accept(java.util.List<T> value)

    - #### boolean add(java.lang.Object value)

      Implementation of add that adds any value as a bound promise

      Parameters:
        `callable` - The callable
      Returns:
        True if it was added

    - #### boolean add(groovy.lang.Closure callable)

      Implementation of add that takes a closure and creates a promise, adding it to the list

      Parameters:
        `callable` - The callable
      Returns:
        True if it was added

    - #### boolean add(Promise<T> p)

      Implementation of add that takes a promise, adding it to the list

      Parameters:
        `callable` - The callable
      Returns:
        True if it was added

    - #### @java.lang.Override boolean cancel(boolean mayInterruptIfRunning)

      Synchronously obtains all the values from all the promises

      Returns:
        The values

    - #### java.util.List get()

    - #### @java.lang.Override java.util.List get(long timeout, java.util.concurrent.TimeUnit units)

    - #### @java.lang.Override boolean isCancelled()

    - #### @java.lang.Override boolean isDone()

    - #### PromiseList leftShift(groovy.lang.Closure callable)

      Add a promise to the promise list

      Parameters:
        `callable` - The callable
      Returns:
        The promise list

    - #### PromiseList leftShift(java.lang.Object value)

      Add a value as a bound promise to the list of values

      Parameters:
        `callable` - The callable
      Returns:
        The promise list

    - #### PromiseList leftShift(Promise p)

      Add a promise to the promise list

      Parameters:
        `callable` - The callable
      Returns:
        The promise list

    - #### @java.lang.SuppressWarnings("unchecked") Promise onComplete(groovy.lang.Closure callable)

      Execute the given closure when all promises are complete

      Parameters:
        `callable` - The callable

    - #### @java.lang.SuppressWarnings("unchecked") Promise onError(groovy.lang.Closure callable)

    - #### @java.lang.SuppressWarnings("unchecked") Promise then(groovy.lang.Closure callable)