public final class MutableDynamicDataMap extends DynamicDataMap


A mutable heterogeneous map of DynamicType keys to their corresponding values. This (and DynamicDataMap) act like MutableMap (and Map), but with type safety for key and value pairs.

Summary

Public constructors

Public methods

final void

Adds all key/values from other to this map.

final void
@RequiresSchemaVersion(major = 1, minor = 200)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicBool> key,
    boolean value
)

Associates a boolean value with a DynamicBool in this map.

final void
@RequiresSchemaVersion(major = 1, minor = 200)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicColor> key,
    @NonNull Color value
)

Associates a color value with a DynamicColor in this map.

final void
@RequiresSchemaVersion(major = 1, minor = 300)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicDuration> key,
    @NonNull Duration value
)

Associates a Duration with a DynamicDuration in this map.

final void

Associates value with key in this map.

final void
@RequiresSchemaVersion(major = 1, minor = 200)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicFloat> key,
    float value
)

Associates a float value with a DynamicFloat in this map.

final void
@RequiresSchemaVersion(major = 1, minor = 300)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInstant> key,
    @NonNull Instant value
)

Associates a Instant with a DynamicInstant in this map.

final void
@RequiresSchemaVersion(major = 1, minor = 200)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInt32> key,
    int value
)

Associates a integer value with a DynamicInt32 in this map.

final void
@RequiresSchemaVersion(major = 1, minor = 200)
set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicString> key,
    @NonNull String value
)

Associates a string value with a DynamicString in this map.

Inherited methods

From androidx.wear.protolayout.expression.DynamicDataMap
final boolean

Returns true if this map contains the specified key and it is associated with the specified type T.

final boolean
<T extends DynamicBuilders.DynamicType> contains(
    @NonNull DynamicDataKey<@NonNull T> key,
    @NonNull Class<@NonNull T> type
)

Returns true if this map contains the specified key and it is associated with the specified type.

boolean
equals(Object other)
final Boolean

Gets the boolean value mapped to key.

final Color

Gets the color value mapped to key.

final Duration

Gets the Duration value mapped to key.

final Float

Gets the float value mapped to key.

final Instant

Gets the Instant value mapped to key.

final Integer

Gets the integer value mapped to key.

final String

Gets the string value mapped to key.

final @NonNull Set<@NonNull Map.Entry<@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicType>, @NonNull DynamicDataBuilders.DynamicDataValue<@NonNull DynamicBuilders.DynamicType>>>

Returns a read-only Set of all key/value pairs in this map.

final @NonNull Set<@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicType>>

Returns a read-only Set of all keys in this map.

final int

Returns the number of key/value pairs in the map.

final @NonNull Collection<@NonNull DynamicDataBuilders.DynamicDataValue<@NonNull DynamicBuilders.DynamicType>>

Returns a read-only Collection of all values in this map.

int
final @NonNull DynamicDataMap
@NonNull String

Public constructors

MutableDynamicDataMap

Added in 1.3.0-alpha08
public MutableDynamicDataMap(@NonNull DynamicDataPair<@NonNull ?> pairs)

Public methods

putAll

Added in 1.3.0-alpha08
public final void putAll(@NonNull DynamicDataMap other)

Adds all key/values from other to this map. Potentially overwriting any common key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 200)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicBool> key,
    boolean value
)

Associates a boolean value with a DynamicBool in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicBool> key

represent a key that other APIs can use to reference values value.

boolean value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 200)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicColor> key,
    @NonNull Color value
)

Associates a color value with a DynamicColor in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicColor> key

represent a key that other APIs can use to reference values value.

@NonNull Color value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 300)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicDuration> key,
    @NonNull Duration value
)

Associates a Duration with a DynamicDuration in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicDuration> key

represent a key that other APIs can use to reference values value.

@NonNull Duration value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
public final void <T extends DynamicBuilders.DynamicType> set(
    @NonNull DynamicDataKey<@NonNull T> key,
    @NonNull DynamicDataBuilders.DynamicDataValue<@NonNull T> value
)

Associates value with key in this map.

Parameters
@NonNull DynamicDataKey<@NonNull T> key

represent a key that other APIs can use to reference values value.

@NonNull DynamicDataBuilders.DynamicDataValue<@NonNull T> value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 200)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicFloat> key,
    float value
)

Associates a float value with a DynamicFloat in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicFloat> key

represent a key that other APIs can use to reference values value.

float value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 300)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInstant> key,
    @NonNull Instant value
)

Associates a Instant with a DynamicInstant in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInstant> key

represent a key that other APIs can use to reference values value.

@NonNull Instant value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 200)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInt32> key,
    int value
)

Associates a integer value with a DynamicInt32 in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicInt32> key

represent a key that other APIs can use to reference values value.

int value

is the static value to use for resolving references to key.

set

Added in 1.3.0-alpha08
@RequiresSchemaVersion(major = 1, minor = 200)
public final void set(
    @NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicString> key,
    @NonNull String value
)

Associates a string value with a DynamicString in this map.

Parameters
@NonNull DynamicDataKey<@NonNull DynamicBuilders.DynamicString> key

represent a key that other APIs can use to reference values value.

@NonNull String value

is the static value to use for resolving references to key.