Package org.spongepowered.api.data.value
Interface MapValue<K,V>
-
- All Known Subinterfaces:
MapValue.Immutable<K,V>
,MapValue.Mutable<K,V>
public interface MapValue<K,V> extends Value<Map<K,V>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
MapValue.Immutable<K,V>
Represents a specialized type ofValue.Immutable
that is different from anCollectionValue.Immutable
such that the "elements" areMap.Entry
.static interface
MapValue.Mutable<K,V>
Represents a specialized type ofValue.Mutable
that is different from aCollectionValue.Mutable
such 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.boolean
containsKey(K key)
Checks if the provided key is contained within this map.boolean
containsValue(V value)
Checks if the provided value is contained within this map.Set<Map.Entry<K,V>>
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<? extends MapValue<K,V>>
key()
Gets the key for thisValue
.Set<K>
keySet()
Gets anSet
of all keys contained in this map value.static <K,V>
MapValue.Mutable<K,V>mutableOf(Supplier<? extends Key<? extends MapValue<K,V>>> key, Map<K,V> element)
static <K,V>
MapValue.Mutable<K,V>mutableOf(Key<? extends MapValue<K,V>> key, Map<K,V> element)
int
size()
Gets the size of this map.Collection<V>
values()
Retrieves anCollection
of all available values within this map.
-
-
-
Method Detail
-
mutableOf
static <K,V> MapValue.Mutable<K,V> mutableOf(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
-
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
Key<? extends MapValue<K,V>> key()
Description copied from interface:Value
Gets 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
Set<K> keySet()
Gets anSet
of all keys contained in this map value.- Returns:
- The set of keys
-
values
Collection<V> values()
Retrieves anCollection
of all available values within this map.- Returns:
- The collection of values
-
asMutable
MapValue.Mutable<K,V> asMutable()
Description copied from interface:Value
Retrieves a mutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Mutable
instance where this would simply return itself. In other cases, where the retrieved value is anValue.Immutable
instance, a new mutable value is created with the same key and values.
-
asMutableCopy
MapValue.Mutable<K,V> asMutableCopy()
Description copied from interface:Value
Retrieves a copy in the mutable form of this value. The new is created with the same key and values.- Specified by:
asMutableCopy
in interfaceValue<K>
- Returns:
- A mutable value
-
asImmutable
MapValue.Immutable<K,V> asImmutable()
Description copied from interface:Value
Retrieves an immutable form of this value. Due to the vague nature of the value itself, some cases can already provide aValue.Immutable
instance where this would simply return itself. In other cases, where the retrieved value is aValue.Mutable
instance, a new immutable value is created with the same key and values.- Specified by:
asImmutable
in interfaceValue<K>
- Returns:
- An immutable value
-
-