api / org.gradle.kotlin.dsl / org.gradle.api.DomainObjectCollection / withType

withType

inline fun <reified S : Any> DomainObjectCollection<in S>.withType(crossinline configuration: S.() -> Unit): DomainObjectCollection<S>

Returns a collection containing the objects in this collection of the given type. Equivalent to calling {@code withType(type).all(configureAction)}

Parameters

S - The type of objects to find.

configuration - The action to execute for each object in the resulting collection.

Return
The matching objects. Returns an empty collection if there are no such objects in this collection.

See Also

DomainObjectCollection.withType

inline fun <reified S : Any> DomainObjectCollection<in S>.withType(): DomainObjectCollection<S>

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.

Parameters

S - The type of objects to find.

Return
The matching objects. Returns an empty collection if there are no such objects in this collection.

See Also

DomainObjectCollection.withType