# SetProperty

@ManagedType
interface SetProperty<T> : Provider<T> , HasMultipleValues<T>

Represents a property whose type is a Set of elements of type T. Retains iteration order.

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

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

#### Since

4.5

#### 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>): SetProperty<T>
abstract fun convention(provider: Provider<out Iterable<out T>>): SetProperty<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(): SetProperty<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(): SetProperty<T>
This is similar to calling value with a `null` argument.
unsetConvention
Link copied to clipboard
abstract fun unsetConvention(): SetProperty<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>): SetProperty<T>
abstract fun value(provider: Provider<out Iterable<out T>>): SetProperty<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>