For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

matching

abstract fun matching(spec: Spec<in T>): NamedDomainObjectCollection<T>(source)

Returns a collection which contains the objects in this collection which meet the given specification. The returned collection is live, so that when matching objects are added to this collection, they are also visible in the filtered collection.

This method is an intermediate eager operation. The application of the filter forces the realization of the collection elements.


abstract fun matching(spec: Closure): NamedDomainObjectCollection<T>(source)

Returns a collection which contains the objects in this collection which meet the given closure specification. The returned collection is live, so that when matching objects are added to this collection, they are also visible in the filtered collection.

This method is an intermediate eager operation. The application of the filter forces the realization of the collection elements.