Interface Value.Mutable<E>

Type Parameters:
E - The type of element
All Superinterfaces:
Value<E>
All Known Subinterfaces:
CollectionValue.Mutable<E,C,M,I>, ListValue.Mutable<E>, MapValue.Mutable<K,V>, SetValue.Mutable<E>, WeightedCollectionValue.Mutable<E>
Enclosing interface:
Value<E>

public static interface Value.Mutable<E> extends Value<E>
Represents a type of Value that is mutable. Simply put, the underlying value can always be changed without creating a new Value.Mutable.
  • Method Details

    • set

      Value.Mutable<E> set(E value)
      Sets the underlying value to the provided value.
      Parameters:
      value - The value to set
      Returns:
      The owning ValueContainer
    • transform

      Value.Mutable<E> transform(Function<E,E> function)
      Attempts to transform the underlying value based on the provided Function such that the result of Function.apply(Object) will replace the underlying value.
      Parameters:
      function - The function to apply on the existing value
      Returns:
      The owning ValueContainer
    • asImmutable

      Value.Immutable<E> asImmutable()
      Gets the Value.Immutable version of this Value.Mutable such that all data is duplicated across to the new Value.Immutable. Note that once created, the Value.Immutable is not going to change.
      Specified by:
      asImmutable in interface Value<E>
      Returns:
      A new Value.Immutable instance
    • asMutable

      default Value.Mutable<E> 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 Value<E>
      Returns:
      A mutable value
    • asMutableCopy

      default Value.Mutable<E> 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 interface Value<E>
      Returns:
      A mutable value
    • copy

      Value.Mutable<E> copy()
      Makes an independent copy of this Value.Mutable with the same initial data. Both this value and the new value will refer to the same object initially.
      Returns:
      A new copy of this Value.Mutable