Interface IMapItem<VALUE extends ICollectionValue>

Type Parameters:
VALUE - the value type
All Superinterfaces:
ICollectionValue, IFunction, IItem, Map<IMapKey,VALUE>

public interface IMapItem<VALUE extends ICollectionValue> extends IFunction, Map<IMapKey,VALUE>
Represents a mapping of IMapKey keys to values.
  • 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 <V extends ICollectionValue> IMapItem<V> empty()
      Get an empty, immutable map item.
      Type Parameters:
      V - the value Java type
      Returns:
      an immutable map item
    • getValue

      Map<IMapKey,VALUE> 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
    • isEmpty

      default boolean isEmpty()
      Determine if this sequence is empty.
      Specified by:
      isEmpty in interface Map<IMapKey,VALUE 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 Map<IMapKey,VALUE extends ICollectionValue>
      Returns:
      the count of items
    • toMapItem

      @NonNull static <T extends ICollectionValue> Collector<Map.Entry<IMapKey,T>,?,IMapItem<T>> toMapItem()
      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<IMapItem<VALUE>> 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
    • ofCollection

      @NonNull static <V extends ICollectionValue> IMapItem<V> ofCollection(@NonNull Map<IMapKey,V> map)
      Get a new, immutable map item that contains the items in the provided map.
      Type Parameters:
      V - the value Java type
      Parameters:
      map - the map whose items are to be added to the new map
      Returns:
      a map item containing the specified entries
    • of

      @NonNull static <V extends ICollectionValue> IMapItem<V> of()
      Returns an unmodifiable map item containing zero mappings.
      Type Parameters:
      V - the value Java type
      Returns:
      an empty IMapItem
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1)
      Returns an unmodifiable map item containing a single mapping.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the mapping's key
      v1 - the mapping's value
      Returns:
      a map item containing the specified mapping
      Throws:
      NullPointerException - if the key or the value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2)
      Returns an unmodifiable map item containing two mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if the keys are duplicates
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3)
      Returns an unmodifiable map item containing three mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4)
      Returns an unmodifiable map item containing four mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5)
      Returns an unmodifiable map item containing five mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6)
      Returns an unmodifiable map item containing six mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7)
      Returns an unmodifiable map item containing seven mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7, @NonNull K k8, @NonNull V v8)
      Returns an unmodifiable map item containing eight mappings. See Unmodifiable Maps for details.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      k8 - the eighth mapping's key
      v8 - the eighth mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7, @NonNull K k8, @NonNull V v8, @NonNull K k9, @NonNull V v9)
      Returns an unmodifiable map item containing nine mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      k8 - the eighth mapping's key
      v8 - the eighth mapping's value
      k9 - the ninth mapping's key
      v9 - the ninth mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • of

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7, @NonNull K k8, @NonNull V v8, @NonNull K k9, @NonNull V v9, @NonNull K k10, @NonNull V v10)
      Returns an unmodifiable map item containing ten mappings.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      k8 - the eighth mapping's key
      v8 - the eighth mapping's value
      k9 - the ninth mapping's key
      v9 - the ninth mapping's value
      k10 - the tenth mapping's key
      v10 - the tenth mapping's value
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any key or value is null
    • ofEntries

      @SafeVarargs @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> ofEntries(Map.Entry<IMapKey,? extends V>... entries)
      Returns an unmodifiable map item containing keys and values extracted from the given entries. The entries themselves are not stored in the map.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      entries - Map.Entrys containing the keys and values from which the map is populated
      Returns:
      a map item containing the specified mappings
      Throws:
      IllegalArgumentException - if there are any duplicate keys
      NullPointerException - if any entry, key, or value is null, or if the entries array is null
    • entry

      @NonNull static <V extends ICollectionValue> Map.Entry<IMapKey,V> entry(@NonNull IAnyAtomicItem key, @NonNull V value)
      Returns an unmodifiable Map.Entry containing the given key and value.
      Type Parameters:
      V - the value's type
      Parameters:
      key - the key
      value - the value
      Returns:
      an Map.Entry containing the specified key and value
      Throws:
      NullPointerException - if the key or value is null
    • entry

      @NonNull static <V extends ICollectionValue> Map.Entry<IMapKey,V> entry(@NonNull IMapKey key, @NonNull V value)
      Returns an unmodifiable Map.Entry containing the given key and value.
      Type Parameters:
      V - the value's type
      Parameters:
      key - the key
      value - the value
      Returns:
      an Map.Entry containing the specified key and value
      Throws:
      NullPointerException - if the key or value is null
    • copyOf

      @NonNull static <K extends IAnyAtomicItem, V extends ICollectionValue> IMapItem<V> copyOf(Map<? extends IMapKey,? extends V> map)
      Returns an unmodifiable Map item containing the entries of the given Map. The given Map must not be null, and it must not contain any null keys or values. If the given Map is subsequently modified, the returned Map will not reflect such modifications.
      Type Parameters:
      K - the map item's key type
      V - the map item's value type
      Parameters:
      map - a map item from which entries are drawn, must be non-null
      Returns:
      a map item containing the entries of the given Map
      Throws:
      NullPointerException - if map is null, or if it contains any null keys or values
    • 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