# MapProperty

@ManagedType
@SupportsKotlinAssignmentOverloading
interface MapProperty<K, V> : Provider<Map<K, V>> , HasConfigurableValue, SupportsConvention(source)

Represents a property whose type is a Map of keys of type K and values of type V. Retains iteration order.

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

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

#### Since

5.1

#### Parameters

<K>

the type of keys.

<V>

the type of values.

#### See also

ManagedType

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

ObjectFactory

Create an instance of this manually.

## Functions

convention
Link copied to clipboard
abstract fun convention(@Nullable value: @Nullable Map<out K, out V>): MapProperty<K, V>
Specifies the value to use as the convention for this property.
abstract fun convention(valueProvider: Provider<out Map<out K, out V>>): MapProperty<K, V>
Specifies the provider of the value to use as the convention for this property.
disallowChanges
Link copied to clipboard
abstract fun disallowChanges()
Disallows further direct changes to this object.
disallowUnsafeRead
Link copied to clipboard
abstract fun disallowUnsafeRead()
Disallows reading the value of this object when its value may not yet be available or may still change.
empty
Link copied to clipboard
abstract fun empty(): MapProperty<K, V>
Sets the value of this property to an empty map, and replaces any existing value.
filter
Link copied to clipboard
@Incubating
abstract fun filter(spec: Spec<in T>): Provider<T>
Returns a new Provider with the value of this provider if the passed spec is satisfied and no value otherwise.
finalizeValue
Link copied to clipboard
abstract fun finalizeValue()
Disallows further changes to the value of this property.
finalizeValueOnRead
Link copied to clipboard
abstract fun finalizeValueOnRead()
Requests that the final value of this object be calculated on the next read of the value, if not already known.
flatMap
Link copied to clipboard
abstract fun <S> flatMap(transformer: Transformer<out @Nullable Provider<out S>, in T>): Provider<S>
Returns a new Provider from the value of this provider transformed using the given function.
get
Link copied to clipboard
abstract fun get(): T
Returns the value of this provider if it has a value present, otherwise throws `java.lang.IllegalStateException`.
getOrElse
Link copied to clipboard
abstract fun getOrElse(defaultValue: T): T
Returns the value of this provider if it has a value present.
getOrNull
Link copied to clipboard
@Nullable
abstract fun getOrNull(): @Nullable T
Returns the value of this provider if it has a value present.
getting
Link copied to clipboard
abstract fun getting(key: K): Provider<V>
Returns a provider that resolves to the value of the mapping of the given key.
isPresent
Link copied to clipboard
abstract fun isPresent(): Boolean
Returns `true` if there is a value present, otherwise `false`.
keySet
Link copied to clipboard
abstract fun keySet(): Provider<Set<K>>
Returns a Provider that returns the set of keys for the map that is the property value.
map
Link copied to clipboard
abstract fun <S> map(transformer: Transformer<out @Nullable S, in T>): Provider<S>
Returns a new Provider whose value is the value of this provider transformed using the given function.
orElse
Link copied to clipboard
abstract fun orElse(value: T): Provider<T>
Returns a Provider whose value is the value of this provider, if present, otherwise the given default value.
abstract fun orElse(provider: Provider<out T>): Provider<T>
Returns a Provider whose value is the value of this provider, if present, otherwise uses the value from the given provider, if present.
put
Link copied to clipboard
abstract fun put(key: K, value: V)
abstract fun put(key: K, providerOfValue: Provider<out V>)
Adds a map entry to the property value.
putAll
Link copied to clipboard
abstract fun putAll(entries: Map<out K, out V>)
abstract fun putAll(provider: Provider<out Map<out K, out V>>)
Adds all entries from another Map to the property value.
set
Link copied to clipboard
abstract fun set(@Nullable entries: @Nullable Map<out K, out V>)
Sets the value of this property to the entries of the given Map, and replaces any existing value.
abstract fun set(provider: Provider<out Map<out K, out V>>)
Sets the property to have the same value of the given provider, and replaces any existing value.
unset
Link copied to clipboard
@Incubating
abstract fun unset(): MapProperty<K, V>
Unsets this object's explicit value, allowing the convention to be selected when evaluating this object's value.
unsetConvention
Link copied to clipboard
@Incubating
abstract fun unsetConvention(): MapProperty<K, V>
Unsets this object's convention value.
value
Link copied to clipboard
abstract fun value(@Nullable entries: @Nullable Map<out K, out V>): MapProperty<K, V>
Sets the value of this property to the entries of the given Map, and replaces any existing value.
abstract fun value(provider: Provider<out Map<out K, out V>>): MapProperty<K, V>
Sets the property to have the same value of the given provider, and replaces any existing value.
zip
Link copied to clipboard
abstract fun <U, R> zip(right: Provider<U>, combiner: BiFunction<in T, in U, out @Nullable R>): Provider<R>
Returns a provider which value will be computed by combining this provider value with another provider value using the supplied combiner function.