Package: org.gradle.api.tasks

## [Java] Interface TaskCollection<T>

- org.gradle.api.NamedDomainObjectSet

- All Superinterfaces:
    DomainObjectCollection, Iterable, NamedDomainObjectCollection, Collection, NamedDomainObjectSet

  A `TaskCollection` contains a set of Task instances, and provides a number of query methods.

  Parameters:
    `` - The type of tasks which this collection contains.

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `T` | `getAt(String name)` {@inheritDoc}
    `T` | `getByName(String name, groovy.lang.Closure configureClosure)` {@inheritDoc}
    `T` | `getByName(String name)` {@inheritDoc}
    `TaskCollection<T>` | `matching(Spec<? super T> spec)` {@inheritDoc}
    `TaskCollection<T>` | `matching(groovy.lang.Closure closure)` {@inheritDoc}
    `Action<? super T>` | `whenTaskAdded(Action<? super T> action)` Adds an `Action` to be executed when a task is added to this collection.
    `void` | `whenTaskAdded(groovy.lang.Closure closure)` Adds a closure to be called when a task is added to this collection.
    `TaskCollection<S>` | `withType(Class<S> type)` {@inheritDoc}

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface NamedDomainObjectSet` | `findAll, matching, matching, withType`
    `interface NamedDomainObjectCollection` | `add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getNames, getRules, matching, matching, withType`
    `interface Set` | `add, equals, hashCode, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, remove, containsAll, removeAll, retainAll`

- - ### Method Detail

    - #### public T getAt(String name)

      {@inheritDoc}

    - #### public T getByName(String name, groovy.lang.Closure configureClosure)

      {@inheritDoc}

    - #### public T getByName(String name)

      {@inheritDoc}

    - #### public TaskCollection<T> matching(Spec<? super T> spec)

      {@inheritDoc}

    - #### public TaskCollection<T> matching(groovy.lang.Closure closure)

      {@inheritDoc}

    - #### @SuppressWarnings("UnusedDeclaration") public Action<? super T> whenTaskAdded(Action<? super T> action)

      Adds an `Action` to be executed when a task is added to this collection.

      Parameters:
        `action` - The action to be executed
      Returns:
        the supplied action

    - #### @SuppressWarnings("UnusedDeclaration") public void whenTaskAdded(groovy.lang.Closure closure)

      Adds a closure to be called when a task is added to this collection. The task is passed to the closure as the parameter.

      Parameters:
        `closure` - The closure to be called

    - #### public TaskCollection<S> withType(Class<S> type)

      {@inheritDoc}