Package org.spongepowered.api.data.value
Interface MapValue<K,V>
-
- All Superinterfaces:
Value<java.util.Map<K,V>>
- All Known Subinterfaces:
MapValue.Immutable<K,V>,MapValue.Mutable<K,V>
public interface MapValue<K,V> extends Value<java.util.Map<K,V>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMapValue.Immutable<K,V>Represents a specialized type ofValue.Immutablethat is different from anCollectionValue.Immutablesuch that the "elements" areMap.Entry.static interfaceMapValue.Mutable<K,V>Represents 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
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description MapValue.Immutable<K,V>asImmutable()Retrieves an immutable form of this value.MapValue.Mutable<K,V>asMutable()Retrieves a mutable form of this value.MapValue.Mutable<K,V>asMutableCopy()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.java.util.Set<java.util.Map.Entry<K,V>>entrySet()Retrieves anSetof theMap.Entrys contained within this map value.static <K,V>
MapValue.Immutable<K,V>immutableOf(java.util.function.Supplier<? extends Key<? extends MapValue<K,V>>> key, java.util.Map<K,V> element)static <K,V>
MapValue.Immutable<K,V>immutableOf(Key<? extends MapValue<K,V>> key, java.util.Map<K,V> element)Key<? extends MapValue<K,V>>key()Gets the key for thisValue.java.util.Set<K>keySet()Gets anSetof all keys contained in this map value.static <K,V>
MapValue.Mutable<K,V>mutableOf(java.util.function.Supplier<? extends Key<? extends MapValue<K,V>>> key, java.util.Map<K,V> element)static <K,V>
MapValue.Mutable<K,V>mutableOf(Key<? extends MapValue<K,V>> key, java.util.Map<K,V> element)intsize()Gets the size of this map.java.util.Collection<V>values()Retrieves anCollectionof all available values within this map.
-
-
-
Method Detail
-
mutableOf
static <K,V> MapValue.Mutable<K,V> mutableOf(Key<? extends MapValue<K,V>> key, java.util.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
-
mutableOf
static <K,V> MapValue.Mutable<K,V> mutableOf(java.util.function.Supplier<? extends Key<? extends MapValue<K,V>>> key, java.util.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, java.util.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(java.util.function.Supplier<? extends Key<? extends MapValue<K,V>>> key, java.util.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
Key<? extends MapValue<K,V>> 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
boolean containsKey(K key)
Checks if the provided key is contained within this map.- Parameters:
key- The key to check- Returns:
- True if the key is contained
-
containsValue
boolean containsValue(V value)
Checks if the provided value is contained within this map.- Parameters:
value- The value to check- Returns:
- True if the value is contained
-
keySet
java.util.Set<K> keySet()
Gets anSetof all keys contained in this map value.- Returns:
- The set of keys
-
entrySet
java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Retrieves anSetof theMap.Entrys contained within this map value.- Returns:
- The immutable set of entries
-
values
java.util.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
-
-