# ListProperty

@ManagedType
interface ListProperty<T> : Provider<T> , HasMultipleValues<T> (source)

Represents a property whose type is a List of elements of type T.

Instances of this interface are not thread-safe for reading and writing. It is not safe to share the same ListProperty instance between different projects.

Note: This interface is not intended for implementation by build script or plugin authors.

#### Since

4.3

#### Parameters

<T>

the type of elements.

#### See also

ManagedType

Create an instance of this as a managed property (preferred).

ObjectFactory

Create an instance of this manually.

## Functions

add
Link copied to clipboard
abstract fun add(element: T)
addAll
Link copied to clipboard
abstract fun addAll(elements: Array<T>)
assign
Link copied to clipboard
fun <T : Any> HasMultipleValues<T>.assign(elements: Iterable<T>?)

Sets the value of the property to the elements of the given iterable, and replaces any existing value

fun <T : Any> HasMultipleValues<T>.assign(provider: Provider<out Iterable<T>>)

Sets the property to have the same value of the given provider, and replaces any existing value

convention
Link copied to clipboard
abstract fun convention(@Nullable elements: @Nullable Iterable<out T>): ListProperty<T>
abstract fun convention(provider: Provider<out Iterable<out T>>): ListProperty<T>
disallowChanges
Link copied to clipboard
abstract fun disallowChanges()
disallowUnsafeRead
Link copied to clipboard
abstract fun disallowUnsafeRead()
empty
Link copied to clipboard
abstract fun empty(): ListProperty<T>
filter
Link copied to clipboard
abstract fun filter(spec: Spec<in T>): Provider<T>
finalizeValue
Link copied to clipboard
abstract fun finalizeValue()
finalizeValueOnRead
Link copied to clipboard
abstract fun finalizeValueOnRead()
flatMap
Link copied to clipboard
abstract fun <S> flatMap(transformer: Transformer<out @Nullable Provider<out S>, in T>): Provider<S>
get
Link copied to clipboard
abstract fun get(): T
getOrElse
Link copied to clipboard
abstract fun getOrElse(defaultValue: T): T
getOrNull
Link copied to clipboard
abstract fun getOrNull(): @Nullable T
isPresent
Link copied to clipboard
abstract fun isPresent(): Boolean
map
Link copied to clipboard
abstract fun <S> map(transformer: Transformer<out @Nullable S, in T>): Provider<S>
orElse
Link copied to clipboard
abstract fun orElse(value: T): Provider<T>
set
Link copied to clipboard
abstract fun set(elements: @Nullable Iterable<out T>)
unset
Link copied to clipboard
abstract fun unset(): ListProperty<T>
This is similar to calling value with a `null` argument.
unsetConvention
Link copied to clipboard
abstract fun unsetConvention(): ListProperty<T>
This is similar to calling convention with a `null` argument.
value
Link copied to clipboard
abstract fun value(@Nullable elements: @Nullable Iterable<out T>): ListProperty<T>
abstract fun value(provider: Provider<out Iterable<out T>>): ListProperty<T>
zip
Link copied to clipboard
abstract fun <U, R> zip(right: Provider<U>, combiner: BiFunction<in T, in U, out @Nullable R>): Provider<R>