Interface IArrayItem<ITEM extends ICollectionValue>

Type Parameters:
ITEM - the Metapath item type of array members
All Superinterfaces:
Collection<ITEM>, ICollectionValue, IFunction, IItem, Iterable<ITEM>, List<ITEM>

public interface IArrayItem<ITEM extends ICollectionValue> extends IFunction, List<ITEM>
A representation of a Metapath array item type.

Instances of this interface are required to enforce non-mutability for array contents.

  • Method Details

    • type

      @NonNull static IItemType type()
      Get the type information for this item.
      Returns:
      the type information
    • getType

      default IItemType getType()
      Description copied from interface: IItem
      Get the type information for the item.
      Specified by:
      getType in interface IFunction
      Specified by:
      getType in interface IItem
      Returns:
      the item's type information
    • empty

      @NonNull static <T extends ICollectionValue> IArrayItem<T> empty()
      Get an empty, immutable array item.
      Type Parameters:
      T - the item Java type
      Returns:
      an immutable map item
    • getValue

      List<ITEM> getValue()
      Description copied from interface: IItem
      Get the item's "wrapped" value. This "wrapped" value may be:
      • In the case of an Assembly, a Java object representing the fields and flags of the assembly.
      • In the case of a Field with flags, a Java object representing the field value and flags of the field.
      • In the case of a Field without flags or a flag, a Java type managed by a IDataTypeAdapter or a primitive type provided by the Java standard library.
      Specified by:
      getValue in interface IItem
      Returns:
      the value or null if the item has no available value
    • hasValue

      default boolean hasValue()
      Description copied from interface: IItem
      Determine if the item has an associated value.
      Specified by:
      hasValue in interface IItem
      Returns:
      true if the item has a non-null value or false otherwise
    • contentsAsSequence

      default ISequence<?> contentsAsSequence()
      Description copied from interface: ICollectionValue
      Get the collection value as a sequence.

      If the value is already a sequence, the value is returned as a sequence. Otherwise, if the value is an item, what is returned depends on the item type:

      • IArrayItem or IMapItem: the contents of the returned sequence are the items of the array or map. Any member values that are a sequence are flattened.
      • Any other item: A singleton sequence is returned containing the item.
      Specified by:
      contentsAsSequence in interface ICollectionValue
      Specified by:
      contentsAsSequence in interface IItem
      Returns:
      the resulting sequence
    • atomize

      default Stream<IAnyAtomicItem> atomize()
      Description copied from interface: IItem
      Produce a stream of atomic items based on the atomic value of these items.

      Supports item atomization.

      Specified by:
      atomize in interface ICollectionValue
      Specified by:
      atomize in interface IItem
      Returns:
      a stream of atomized atomic items.
    • isEmpty

      default boolean isEmpty()
      Determine if this sequence is empty.
      Specified by:
      isEmpty in interface Collection<ITEM extends ICollectionValue>
      Specified by:
      isEmpty in interface List<ITEM extends ICollectionValue>
      Returns:
      true if the sequence contains no items, or false otherwise
    • size

      default int size()
      Get the count of items in this sequence.
      Specified by:
      size in interface Collection<ITEM extends ICollectionValue>
      Specified by:
      size in interface List<ITEM extends ICollectionValue>
      Returns:
      the count of items
    • contains

      default boolean contains(Object obj)
      Specified by:
      contains in interface Collection<ITEM extends ICollectionValue>
      Specified by:
      contains in interface List<ITEM extends ICollectionValue>
    • toArray

      default Object[] toArray()
      Specified by:
      toArray in interface Collection<ITEM extends ICollectionValue>
      Specified by:
      toArray in interface List<ITEM extends ICollectionValue>
    • toArray

      default <T> T[] toArray(T[] array)
      Specified by:
      toArray in interface Collection<ITEM extends ICollectionValue>
      Specified by:
      toArray in interface List<ITEM extends ICollectionValue>
    • containsAll

      default boolean containsAll(Collection<?> collection)
      Specified by:
      containsAll in interface Collection<ITEM extends ICollectionValue>
      Specified by:
      containsAll in interface List<ITEM extends ICollectionValue>
    • get

      default ITEM get(int index)
      Specified by:
      get in interface List<ITEM extends ICollectionValue>
    • indexOf

      default int indexOf(Object obj)
      Specified by:
      indexOf in interface List<ITEM extends ICollectionValue>
    • lastIndexOf

      default int lastIndexOf(Object obj)
      Specified by:
      lastIndexOf in interface List<ITEM extends ICollectionValue>
    • listIterator

      default ListIterator<ITEM> listIterator()
      Specified by:
      listIterator in interface List<ITEM extends ICollectionValue>
    • listIterator

      default ListIterator<ITEM> listIterator(int index)
      Specified by:
      listIterator in interface List<ITEM extends ICollectionValue>
    • subList

      default List<ITEM> subList(int fromIndex, int toIndex)
      Specified by:
      subList in interface List<ITEM extends ICollectionValue>
    • toArrayItem

      @NonNull static <T extends ICollectionValue> Collector<T,?,IArrayItem<T>> toArrayItem()
      A Collector implementation to generates a sequence from a stream of Metapath items.
      Type Parameters:
      T - the Java type of the items
      Returns:
      a collector that will generate a sequence
    • toSequence

      default ISequence<? extends IArrayItem<ITEM>> toSequence()
      Description copied from interface: ICollectionValue
      Get the collection value as a sequence.

      If the value is already a sequence, the value is returned as a sequence. Otherwise, if the value is an item, a new sequence will be created containing only that item.

      Specified by:
      toSequence in interface ICollectionValue
      Specified by:
      toSequence in interface IItem
      Returns:
      the resulting sequence
    • flatten

      default Stream<? extends IItem> flatten()
      Description copied from interface: ICollectionValue
      Get the stream of items for the collection value.

      If the collection value contains items, then these items are returned.

      Specified by:
      flatten in interface ICollectionValue
      Specified by:
      flatten in interface IItem
      Returns:
      a stream of related items
    • ofCollection

      @NonNull static <T extends ICollectionValue> IArrayItem<T> ofCollection(@NonNull List<T> items)
      Get a new, immutable array item that contains the items in the provided list.
      Type Parameters:
      T - the item Java type
      Parameters:
      items - the list whose items are to be added to the new array
      Returns:
      an array item containing the specified entries
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of()
      Returns an unmodifiable array item containing zero elements.
      Type Parameters:
      T - the item type
      Returns:
      an empty IArrayItem
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1)
      Returns an unmodifiable array item containing one item.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the single item
      Returns:
      an IArrayItem containing the specified item
      Throws:
      NullPointerException - if the item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2)
      Returns an unmodifiable array item containing two items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3)
      Returns an unmodifiable array item containing three elements.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4)
      Returns an unmodifiable array item containing four items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5)
      Returns an unmodifiable array item containing five items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      e5 - the fifth item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6)
      Returns an unmodifiable array item containing six items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      e5 - the fifth item
      e6 - the sixth item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7)
      Returns an unmodifiable array item containing seven items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      e5 - the fifth item
      e6 - the sixth item
      e7 - the seventh item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7, @NonNull T e8)
      Returns an unmodifiable array item containing eight items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      e5 - the fifth item
      e6 - the sixth item
      e7 - the seventh item
      e8 - the eighth item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7, @NonNull T e8, @NonNull T e9)
      Returns an unmodifiable array item containing nine items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      e5 - the fifth item
      e6 - the sixth item
      e7 - the seventh item
      e8 - the eighth item
      e9 - the ninth item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7, @NonNull T e8, @NonNull T e9, @NonNull T e10)
      Returns an unmodifiable array item containing ten items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      e1 - the first item
      e2 - the second item
      e3 - the third item
      e4 - the fourth item
      e5 - the fifth item
      e6 - the sixth item
      e7 - the seventh item
      e8 - the eighth item
      e9 - the ninth item
      e10 - the tenth item
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null
    • of

      @SafeVarargs @NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T... items)
      Returns an unmodifiable array item containing an arbitrary number of items.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      items - the items to be contained in the list
      Returns:
      an IArrayItem containing the specified items
      Throws:
      NullPointerException - if an item is null or if the array is null
    • copyOf

      @NonNull static <T extends ICollectionValue> IArrayItem<T> copyOf(@NonNull Collection<? extends T> collection)
      Returns an unmodifiable array item containing the items of the given Collection, in its iteration order. The given Collection must not be null, and it must not contain any null items. If the given Collection is subsequently modified, the returned array item will not reflect such modifications.
      Type Parameters:
      T - the IArrayItem's item type
      Parameters:
      collection - a Collection from which items are drawn, must be non-null
      Returns:
      an IArrayItem containing the items of the given Collection
      Throws:
      NullPointerException - if collection is null, or if it contains any nulls
    • accept

      default void accept(IItemVisitor visitor)
      Description copied from interface: IItem
      A visitor callback used to visit a variety of Metapath item types.
      Specified by:
      accept in interface IItem
      Parameters:
      visitor - the visitor to call back