Interface ListValue<E>

All Superinterfaces:
CollectionValue<E,List<E>>, Iterable<E>, Value<List<E>>
All Known Subinterfaces:
ListValue.Immutable<E>, ListValue.Mutable<E>

public interface ListValue<E> extends CollectionValue<E,List<E>>
  • Method Details

    • mutableOf

      static <E> ListValue.Mutable<E> mutableOf(Key<? extends ListValue<E>> key, List<E> element)
      Constructs a mutable ListValue of the appropriate type based on the given Key and the element.
      Type Parameters:
      E - The element type
      Parameters:
      key - The key
      element - The element
      Returns:
      The constructed mutable value
    • mutableOf

      static <E> ListValue.Mutable<E> mutableOf(Supplier<? extends Key<? extends ListValue<E>>> key, List<E> element)
      Constructs a mutable ListValue of the appropriate type based on the given Key and the element.
      Type Parameters:
      E - The element type
      Parameters:
      key - The key
      element - The element
      Returns:
      The constructed mutable value
    • immutableOf

      static <E> ListValue.Immutable<E> immutableOf(Key<? extends ListValue<E>> key, List<E> element)
      Constructs an immutable ListValue of the appropriate type based on the given Key and the element.
      Type Parameters:
      E - The element type
      Parameters:
      key - The key
      element - The element
      Returns:
      The constructed immutable value
    • immutableOf

      static <E> ListValue.Immutable<E> immutableOf(Supplier<? extends Key<? extends ListValue<E>>> key, List<E> element)
      Constructs an immutable ListValue of the appropriate type based on the given Key and the element.
      Type Parameters:
      E - The element type
      Parameters:
      key - The key
      element - The element
      Returns:
      The constructed immutable value
    • key

      Key<? extends ListValue<E>> key()
      Description copied from interface: Value
      Gets the key for this Value.
      Specified by:
      key in interface Value<E>
      Returns:
      The key for this value
    • get

      E get(int index)
      Gets the desired element at the desired index.
      Parameters:
      index - The index of the element to return
      Returns:
      The element at the desired index
      Throws:
      IndexOutOfBoundsException - if the index is out of range
    • indexOf

      int indexOf(E element)
      Queries for the index of the provided element. If the element is not contained in this list, -1 is returned.
      Parameters:
      element - The element to get the index from
      Returns:
      The index of the element, -1 if not available
    • asMutable

      ListValue.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 CollectionValue<E,List<E>>
      Specified by:
      asMutable in interface Value<E>
      Returns:
      A mutable value
    • asImmutable

      ListValue.Immutable<E> 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 CollectionValue<E,List<E>>
      Specified by:
      asImmutable in interface Value<E>
      Returns:
      An immutable value