Class ArrayTag<T>

java.lang.Object
org.moddingx.launcherlib.nbt.tag.ArrayTag<T>
All Implemented Interfaces:
Iterable<T>, Tag
Direct Known Subclasses:
ByteArrayTag, IntArrayTag, ListTag, LongArrayTag

public abstract sealed class ArrayTag<T> extends Object implements Tag, Iterable<T> permits ByteArrayTag, IntArrayTag, ListTag, LongArrayTag
Base class for all list-like tags.
  • Field Details

    • elements

      protected final List<T> elements
  • Constructor Details

    • ArrayTag

      protected ArrayTag(TagType type, List<T> elements)
  • Method Details

    • type

      public TagType type()
      Description copied from interface: Tag
      Gets the TagType for this tag.
      Specified by:
      type in interface Tag
    • copy

      public abstract ArrayTag<T> copy()
      Description copied from interface: Tag
      Makes a copy of this tag. For immutable tags, this may return the same object.
      Specified by:
      copy in interface Tag
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • size

      public int size()
      Gets the size of this tag.
    • get

      public T get(int idx)
      Gets the element at the given index.
    • add

      public void add(T value)
      Adds a new element to this tag.
    • add

      public void add(int idx, T value)
      Adds a new element to this tag at the given index.
    • addAll

      public void addAll(List<T> values)
      Adds multiple new elements to this tag.
    • addAll

      public void addAll(int idx, List<T> values)
      Adds multiple new elements to this tag at the given index.
    • set

      public void set(int idx, T value)
      Changes the value at the given index.
    • remove

      public T remove(int idx)
      Removes the value at the given index.
      Returns:
      The value that was removed.
    • clear

      public void clear()
      Removes all elements from this tag.
    • iterator

      @Nonnull public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • listIterator

      @Nonnull public ListIterator<T> listIterator()
    • listIterator

      @Nonnull public ListIterator<T> listIterator(int idx)
    • stream

      @Nonnull public Stream<T> stream()
    • onAdd

      protected void onAdd(T elem)