Interface MapValue.Mutable<K,​V>

  • Type Parameters:
    K - The type of the key
    V - The type of the value
    All Superinterfaces:
    MapValue<K,​V>, Value<java.util.Map<K,​V>>, Value.Mutable<java.util.Map<K,​V>>
    Enclosing interface:
    MapValue<K,​V>

    public static interface MapValue.Mutable<K,​V>
    extends MapValue<K,​V>, Value.Mutable<java.util.Map<K,​V>>
    Represents a specialized type of Value.Mutable that is different from a CollectionValue.Mutable such that the "elements" are Map.Entry. Usually, this type of value is used to represent a particular "type" of "key" that is associated to a particular "value".
    • Method Detail

      • put

        MapValue.Mutable<K,​V> put​(K key,
                                        V value)
        Associates the provided key to the provided value. If there already exists a value for the provided key, the value is replaced.
        Parameters:
        key - The key to associate to the value
        value - The value associated with the key
        Returns:
        This map value, for chaining
      • putAll

        MapValue.Mutable<K,​V> putAll​(java.util.Map<K,​V> map)
        Associates all provided Map.Entry to this map value.
        Parameters:
        map - The map of key values to set
        Returns:
        This map value, for chaining
      • remove

        MapValue.Mutable<K,​V> remove​(K key)
        Removes the association of the provided key to the value currently associated.
        Parameters:
        key - The key to remove
        Returns:
        This map value, for chaining
      • removeAll

        MapValue.Mutable<K,​V> removeAll​(java.lang.Iterable<K> keys)
        Removes all key value associations of the provided keys.
        Parameters:
        keys - The keys to remove
        Returns:
        This map value, for chaining
      • removeAll

        MapValue.Mutable<K,​V> removeAll​(java.util.function.Predicate<java.util.Map.Entry<K,​V>> predicate)
        Applies the Predicate to all Map.Entry within this MapValue.Mutable. Any entries that are false will be removed from the map value.
        Parameters:
        predicate - The predicate to filer
        Returns:
        This map value, for chaining
      • transform

        MapValue.Mutable<K,​V> transform​(java.util.function.Function<java.util.Map<K,​V>,​java.util.Map<K,​V>> function)
        Description copied from interface: Value.Mutable
        Attempts to transform the underlying value based on the provided Function such that the result of Function.apply(Object) will replace the underlying value.
        Specified by:
        transform in interface Value.Mutable<K>
        Parameters:
        function - The function to apply on the existing value
        Returns:
        The owning ValueContainer
      • asMutable

        default 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 a Value.Mutable instance where this would simply return itself. In other cases, where the retrieved value is an Value.Immutable instance, a new mutable value is created with the same key and values.
        Specified by:
        asMutable in interface MapValue<K,​V>
        Specified by:
        asMutable in interface Value<K>
        Specified by:
        asMutable in interface Value.Mutable<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 a Value.Immutable instance where this would simply return itself. In other cases, where the retrieved value is a Value.Mutable instance, a new immutable value is created with the same key and values.
        Specified by:
        asImmutable in interface MapValue<K,​V>
        Specified by:
        asImmutable in interface Value<K>
        Specified by:
        asImmutable in interface Value.Mutable<K>
        Returns:
        An immutable value