gradle
8.2

# whenObjectAdded

abstract fun whenObjectAdded(action: Action<out Any>): Action<out Any>

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

Like all, this method will cause all objects in this container to be realized.

#### Return

the supplied action

#### Parameters

action

The action to be executed

abstract fun whenObjectAdded(action: Closure)

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

#### Parameters

action

The closure to be called

#### See also

whenObjectAdded(Action)