# existing

fun <T : Any, C : NamedDomainObjectCollection<T>> C.existing(action: T.() -> Unit): ExistingDomainObjectDelegateProviderWithAction<out C, T>(source)

### Deprecated

Use 'val element = named(name) { }' instead. See the Gradle 9.6 upgrading guide.

Idiomatic way of referring to the provider of a well-known element of a collection via a delegate property.

`tasks { val jar by existing { ... } }`

#### Since

4.10

#### Parameters

action

the configuration action

#### Type Parameters

T

the domain object type

C

the concrete container type

fun <T : Any, C : NamedDomainObjectCollection<T>, U : T> C.existing(type: KClass<U>): ExistingDomainObjectDelegateProviderWithType<out C, U>(source)

### Deprecated

Use 'val element = named<Type>(name)' instead. See the Gradle 9.6 upgrading guide.

Idiomatic way of referring to the provider of a well-known element of a collection via a delegate property.

`tasks { val jar by existing(Jar::class) }`

#### Since

4.10

#### Parameters

type

the domain object type

#### Type Parameters

T

the domain object type

C

the concrete container type

fun <T : Any, C : NamedDomainObjectCollection<T>, U : T> C.existing(type: KClass<U>, action: U.() -> Unit): ExistingDomainObjectDelegateProviderWithTypeAndAction<out C, U>(source)

### Deprecated

Use 'val element = named<Type>(name) { }' instead. See the Gradle 9.6 upgrading guide.

Idiomatic way of referring to the provider of a well-known element of a collection via a delegate property.

`tasks { val jar by existing(Jar::class) { ... } }`

#### Since

4.10

#### Parameters

type

the domain object type

action

the configuration action

#### Type Parameters

T

the domain object type

C

the concrete container type

val <T : Any, C : NamedDomainObjectCollection<T>> C.existing: ExistingDomainObjectDelegateProvider<out C>(source)

### Deprecated

Use 'val element = named(name)' instead. See the Gradle 9.6 upgrading guide.

Idiomatic way of referring to the provider of a well-known element of a collection via a delegate property.

`tasks { val jar by existing }`

#### Since

4.10

#### Type Parameters

T

the domain object type

C

the concrete container type