# getElements

@Incubating
open fun getElements(): Provider<out Collection<T>>(source)

Return a provider containing all elements added to this collection.

The returned provider retains the build dependencies of providers added by addLater or addAllLater.

The value produced by a provider with build dependencies, by definition, is not valid until those build dependencies are executed. For example, if a task produces an output file, the value of a provider returning that file is not valid until the task executes.

Querying the contents of this provider before the build dependencies of providers added by addLater and addAllLater will result in undefined behavior. In general, the returned provider should only be used to wire values between tasks. Avoid directly calling get or any other method that realizes the value of the returned provier.

#### Since

9.7.0