Domain Object Collection
A DomainObjectCollection
is a specialised Collection that adds the ability to receive modification notifications and use live filtered sub collections.
The filtered collections returned by the filtering methods, such as matching, return collections that are live. That is, they reflect changes made to the source collection that they were created from. This is true for filtered collections made from filtered collections etc.
You can also add actions that are executed as elements are added to the collection. Actions added to filtered collections will be fired if an addition/removal occurs for the source collection that matches the filter.
DomainObjectCollection
instances are not thread-safe and undefined behavior may result from the invocation of any method on a collection that is being mutated by another thread; this includes direct invocations, passing the collection to a method that might perform invocations, and using an existing iterator to examine the collection.
Parameters
The type of objects in this collection.
Inheritors
Functions
Action
to be executed when an object is added to this collection.Action
to be executed when an object is removed from this collection.Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.
Returns a collection containing the objects in this collection of the given type. Equivalent to calling withType(type).all(configureAction)
.
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectCollection.withType.