Interface ListBinaryTag

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  ListBinaryTag.Builder<T extends BinaryTag>
      A list tag builder.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      static @NonNull ListBinaryTag.Builder<BinaryTag> builder()
      Creates a builder.
      static <T extends BinaryTag>
      @NonNull ListBinaryTag.Builder<T>
      builder​(@NonNull BinaryTagType<T> type)
      Creates a builder.
      @NonNull BinaryTagType<? extends BinaryTag> elementType()
      Gets the type of element stored in this list.
      static @NonNull ListBinaryTag empty()
      Gets an empty list tag.
      static @NonNull ListBinaryTag from​(@NonNull Iterable<? extends BinaryTag> tags)
      Creates a list tag from tags.
      @NonNull BinaryTag get​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a tag.
      default byte getByte​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a byte.
      default byte getByte​(@org.checkerframework.checker.index.qual.NonNegative int index, byte defaultValue)
      Gets a byte.
      default byte @NonNull [] getByteArray​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets an array of bytes.
      default byte @NonNull [] getByteArray​(@org.checkerframework.checker.index.qual.NonNegative int index, byte @NonNull [] defaultValue)
      Gets an array of bytes.
      default @NonNull CompoundBinaryTag getCompound​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a compound.
      default @NonNull CompoundBinaryTag getCompound​(@org.checkerframework.checker.index.qual.NonNegative int index, @NonNull CompoundBinaryTag defaultValue)
      Gets a compound.
      default double getDouble​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a double.
      default double getDouble​(@org.checkerframework.checker.index.qual.NonNegative int index, double defaultValue)
      Gets a double.
      default float getFloat​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a float.
      default float getFloat​(@org.checkerframework.checker.index.qual.NonNegative int index, float defaultValue)
      Gets a float.
      default int getInt​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets an int.
      default int getInt​(@org.checkerframework.checker.index.qual.NonNegative int index, int defaultValue)
      Gets an int.
      default int @NonNull [] getIntArray​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets an array of ints.
      default int @NonNull [] getIntArray​(@org.checkerframework.checker.index.qual.NonNegative int index, int @NonNull [] defaultValue)
      Gets an array of ints.
      default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a list.
      default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index, @NonNull ListBinaryTag defaultValue)
      Gets a list.
      default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index, @Nullable BinaryTagType<?> elementType)
      Gets a list.
      default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index, @Nullable BinaryTagType<?> elementType, @NonNull ListBinaryTag defaultValue)
      Gets a list.
      default long getLong​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a long.
      default long getLong​(@org.checkerframework.checker.index.qual.NonNegative int index, long defaultValue)
      Gets a long.
      default long @NonNull [] getLongArray​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets an array of longs.
      default long @NonNull [] getLongArray​(@org.checkerframework.checker.index.qual.NonNegative int index, long @NonNull [] defaultValue)
      Gets an array of longs.
      default short getShort​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a short.
      default short getShort​(@org.checkerframework.checker.index.qual.NonNegative int index, short defaultValue)
      Gets a short.
      default @NonNull String getString​(@org.checkerframework.checker.index.qual.NonNegative int index)
      Gets a string.
      default @NonNull String getString​(@org.checkerframework.checker.index.qual.NonNegative int index, @NonNull String defaultValue)
      Gets a string.
      default @NonNull BinaryTagType<? extends BinaryTag> listType()
      Deprecated.
      since 4.4.0, use elementType() instead
      static @NonNull ListBinaryTag of​(@NonNull BinaryTagType<? extends BinaryTag> type, @NonNull List<BinaryTag> tags)
      Creates a tag.
      @NonNull ListBinaryTag remove​(int index, @Nullable Consumer<? super BinaryTag> removed)
      Removes the tag at index index, optionally providing removedConsumer with the tag previously at index index.
      @NonNull ListBinaryTag set​(int index, @NonNull BinaryTag tag, @Nullable Consumer<? super BinaryTag> removed)
      Sets the tag at index index to tag, optionally providing removedConsumer with the tag previously at index index.
      int size()
      Gets the size.
      @NonNull Stream<BinaryTag> stream()
      Creates a stream of the tags contained within this list.
      default @NonNull BinaryTagType<ListBinaryTag> type()
      Gets the tag type.
      • Methods inherited from interface net.kyori.examination.Examinable

        examinableName, examinableProperties, examine
    • Method Detail

      • empty

        static @NonNull ListBinaryTag empty()
        Gets an empty list tag.
        Returns:
        an empty tag
        Since:
        4.0.0
      • builder

        static <T extends BinaryTag> @NonNull ListBinaryTag.Builder<T> builder​(@NonNull BinaryTagType<T> type)
        Creates a builder.
        Type Parameters:
        T - the element type
        Parameters:
        type - the element type
        Returns:
        a new builder
        Since:
        4.0.0
      • elementType

        @NonNull BinaryTagType<? extends BinaryTag> elementType()
        Gets the type of element stored in this list.
        Returns:
        the type
        Since:
        4.4.0
      • size

        int size()
        Gets the size.
        Returns:
        the size
        Since:
        4.0.0
      • get

        @NonNull BinaryTag get​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a tag.
        Parameters:
        index - the index
        Returns:
        the tag
        Throws:
        IndexOutOfBoundsException - if the index is out of range
        Since:
        4.0.0
      • set

        @NonNull ListBinaryTag set​(int index,
                                   @NonNull BinaryTag tag,
                                   @Nullable Consumer<? super BinaryTag> removed)
        Sets the tag at index index to tag, optionally providing removedConsumer with the tag previously at index index.
        Parameters:
        index - the index
        tag - the tag
        removed - a consumer which receives the tag being removed at index index
        Returns:
        a list tag
        Since:
        4.0.0
      • remove

        @NonNull ListBinaryTag remove​(int index,
                                      @Nullable Consumer<? super BinaryTag> removed)
        Removes the tag at index index, optionally providing removedConsumer with the tag previously at index index.
        Parameters:
        index - the index
        removed - a consumer which receives the tag being removed at index index
        Returns:
        a list tag
        Since:
        4.0.0
      • getByte

        default byte getByte​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a byte.
        Parameters:
        index - the index
        Returns:
        the byte value, or 0
        Since:
        4.0.0
      • getByte

        default byte getByte​(@org.checkerframework.checker.index.qual.NonNegative int index,
                             byte defaultValue)
        Gets a byte.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the byte value, or defaultValue
        Since:
        4.0.0
      • getShort

        default short getShort​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a short.
        Parameters:
        index - the index
        Returns:
        the short value, or 0
        Since:
        4.0.0
      • getShort

        default short getShort​(@org.checkerframework.checker.index.qual.NonNegative int index,
                               short defaultValue)
        Gets a short.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the short value, or defaultValue
        Since:
        4.0.0
      • getInt

        default int getInt​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets an int.
        Parameters:
        index - the index
        Returns:
        the int value, or 0
        Since:
        4.0.0
      • getInt

        default int getInt​(@org.checkerframework.checker.index.qual.NonNegative int index,
                           int defaultValue)
        Gets an int.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the int value, or defaultValue
        Since:
        4.0.0
      • getLong

        default long getLong​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a long.
        Parameters:
        index - the index
        Returns:
        the long value, or 0
        Since:
        4.0.0
      • getLong

        default long getLong​(@org.checkerframework.checker.index.qual.NonNegative int index,
                             long defaultValue)
        Gets a long.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the long value, or defaultValue
        Since:
        4.0.0
      • getFloat

        default float getFloat​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a float.
        Parameters:
        index - the index
        Returns:
        the float value, or 0
        Since:
        4.0.0
      • getFloat

        default float getFloat​(@org.checkerframework.checker.index.qual.NonNegative int index,
                               float defaultValue)
        Gets a float.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the float value, or defaultValue
        Since:
        4.0.0
      • getDouble

        default double getDouble​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a double.
        Parameters:
        index - the index
        Returns:
        the double value, or 0
        Since:
        4.0.0
      • getDouble

        default double getDouble​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                 double defaultValue)
        Gets a double.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the double value, or defaultValue
        Since:
        4.0.0
      • getByteArray

        default byte @NonNull [] getByteArray​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets an array of bytes.
        Parameters:
        index - the index
        Returns:
        the array of bytes, or a zero-length array
        Since:
        4.0.0
      • getByteArray

        default byte @NonNull [] getByteArray​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                              byte @NonNull [] defaultValue)
        Gets an array of bytes.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the array of bytes, or defaultValue
        Since:
        4.0.0
      • getString

        default @NonNull String getString​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a string.
        Parameters:
        index - the index
        Returns:
        the string value, or ""
        Since:
        4.0.0
      • getString

        default @NonNull String getString​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                          @NonNull String defaultValue)
        Gets a string.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the string value, or defaultValue
        Since:
        4.0.0
      • getList

        default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a list.
        Parameters:
        index - the index
        Returns:
        the list, or an empty list if the tag at index index is not a list tag
        Since:
        4.4.0
      • getList

        default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                               @Nullable BinaryTagType<?> elementType)
        Gets a list.
        Parameters:
        index - the index
        elementType - the expected element type of the list at index index
        Returns:
        the list, or an empty list if the tag at index index is not a list tag, or if the list tag's element type is not elementType
        Since:
        4.4.0
      • getList

        default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                               @NonNull ListBinaryTag defaultValue)
        Gets a list.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the list, or defaultValue if the tag at index index is not a list tag
        Since:
        4.4.0
      • getList

        default @NonNull ListBinaryTag getList​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                               @Nullable BinaryTagType<?> elementType,
                                               @NonNull ListBinaryTag defaultValue)
        Gets a list.

        If elementType is non-null and the ListBinaryTag at index index does not match, defaultValue will be returned.

        Parameters:
        index - the index
        elementType - the expected element type of the list at index index
        defaultValue - the default value
        Returns:
        the list, or defaultValue if the tag at index index is not a list tag, or if the list tag's element type is not elementType
        Since:
        4.4.0
      • getCompound

        default @NonNull CompoundBinaryTag getCompound​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets a compound.
        Parameters:
        index - the index
        Returns:
        the compound, or a new compound
        Since:
        4.0.0
      • getCompound

        default @NonNull CompoundBinaryTag getCompound​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                                       @NonNull CompoundBinaryTag defaultValue)
        Gets a compound.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the compound, or defaultValue
        Since:
        4.0.0
      • getIntArray

        default int @NonNull [] getIntArray​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets an array of ints.
        Parameters:
        index - the index
        Returns:
        the array of ints, or a zero-length array
        Since:
        4.0.0
      • getIntArray

        default int @NonNull [] getIntArray​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                            int @NonNull [] defaultValue)
        Gets an array of ints.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the array of ints, or defaultValue
        Since:
        4.0.0
      • getLongArray

        default long @NonNull [] getLongArray​(@org.checkerframework.checker.index.qual.NonNegative int index)
        Gets an array of longs.
        Parameters:
        index - the index
        Returns:
        the array of longs, or a zero-length array
        Since:
        4.0.0
      • getLongArray

        default long @NonNull [] getLongArray​(@org.checkerframework.checker.index.qual.NonNegative int index,
                                              long @NonNull [] defaultValue)
        Gets an array of longs.
        Parameters:
        index - the index
        defaultValue - the default value
        Returns:
        the array of longs, or defaultValue
        Since:
        4.0.0
      • stream

        @NonNull Stream<BinaryTag> stream()
        Creates a stream of the tags contained within this list.
        Returns:
        a new stream
        Since:
        4.2.0