Package org.spongepowered.api.data.value
Interface MapValue<K,V>
- All Known Subinterfaces:
MapValue.Immutable<K,,V> MapValue.Mutable<K,V>
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a specialized type ofValue.Immutablethat is different from anCollectionValue.Immutablesuch that the "elements" areMap.Entry.static interfaceRepresents a specialized type ofValue.Mutablethat is different from aCollectionValue.Mutablesuch that the "elements" areMap.Entry.Nested classes/interfaces inherited from interface org.spongepowered.api.data.value.Value
Value.Factory -
Method Summary
Modifier and TypeMethodDescriptionRetrieves an immutable form of this value.Retrieves a mutable form of this value.Retrieves a copy in the mutable form of this value.booleancontainsKey(K key) Checks if the provided key is contained within this map.booleancontainsValue(V value) Checks if the provided value is contained within this map.entrySet()static <K,V> MapValue.Immutable<K, V> immutableOf(Supplier<? extends Key<? extends MapValue<K, V>>> key, Map<K, V> element) static <K,V> MapValue.Immutable<K, V> immutableOf(Key<? extends MapValue<K, V>> key, Map<K, V> element) key()Gets the key for thisValue.keySet()Gets anSetof all keys contained in this map value.static <K,V> MapValue.Mutable<K, V> static <K,V> MapValue.Mutable<K, V> intsize()Gets the size of this map.values()Retrieves anCollectionof all available values within this map.
-
Method Details
-
mutableOf
- Type Parameters:
K- The map key typeV- The map value type- Parameters:
key- The keyelement- The element- Returns:
- The constructed mutable value
-
mutableOf
static <K,V> MapValue.Mutable<K,V> mutableOf(Supplier<? extends Key<? extends MapValue<K, V>>> key, Map<K, V> element) - Type Parameters:
K- The map key typeV- The map value type- Parameters:
key- The keyelement- The element- Returns:
- The constructed mutable value
-
immutableOf
static <K,V> MapValue.Immutable<K,V> immutableOf(Key<? extends MapValue<K, V>> key, Map<K, V> element) - Type Parameters:
K- The map key typeV- The map value type- Parameters:
key- The keyelement- The element- Returns:
- The constructed immutable value
-
immutableOf
static <K,V> MapValue.Immutable<K,V> immutableOf(Supplier<? extends Key<? extends MapValue<K, V>>> key, Map<K, V> element) - Type Parameters:
K- The map key typeV- The map value type- Parameters:
key- The keyelement- The element- Returns:
- The constructed immutable value
-
key
Description copied from interface:ValueGets the key for thisValue. -
size
int size()Gets the size of this map.- Returns:
- The size of this map
-
containsKey
Checks if the provided key is contained within this map.- Parameters:
key- The key to check- Returns:
- True if the key is contained
-
containsValue
Checks if the provided value is contained within this map.- Parameters:
value- The value to check- Returns:
- True if the value is contained
-
keySet
Gets anSetof all keys contained in this map value.- Returns:
- The set of keys
-
entrySet
- Returns:
- The immutable set of entries
-
values
Collection<V> values()Retrieves anCollectionof all available values within this map.- Returns:
- The collection of values
-
asMutable
MapValue.Mutable<K,V> asMutable()Description copied from interface:ValueRetrieves a mutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Mutableinstance where this would simply return itself. In other cases, where the retrieved value is anValue.Immutableinstance, a new mutable value is created with the same key and values. -
asMutableCopy
MapValue.Mutable<K,V> asMutableCopy()Description copied from interface:ValueRetrieves a copy in the mutable form of this value. The new is created with the same key and values.- Specified by:
asMutableCopyin interfaceValue<K>- Returns:
- A mutable value
-
asImmutable
MapValue.Immutable<K,V> asImmutable()Description copied from interface:ValueRetrieves an immutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Immutableinstance where this would simply return itself. In other cases, where the retrieved value is aValue.Mutableinstance, a new immutable value is created with the same key and values.- Specified by:
asImmutablein interfaceValue<K>- Returns:
- An immutable value
-