Class AbstractArray<T extends Codec>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess, Codec
    Direct Known Subclasses:
    Tuple, Vector

    public class AbstractArray<T extends Codec>
    extends java.util.ArrayList<T>
    implements Codec
    AbstractArray This manages codec arrays. It is an extension to Array, providing specific encoding/decoding on top of the base type.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractArray()  
    • Method Summary

      Modifier and Type Method Description
      boolean eq​(java.lang.Object other)
      Compares the value of the input to see if there is a match
      int getEncodedLength()
      The length of the value when encoded as a Uint8Array
      <T> T getFiled​(int index)  
      boolean isEmpty()
      Checks if the value is an empty value
      int length()
      The length of the value
      java.lang.String toHex()
      Returns a hex string representation of the value
      java.lang.Object toJson()
      Converts the Object to JSON, typically used for RPC transfers
      byte[] toU8a​(boolean isBare)
      Encodes the value as a Uint8Array as per the parity-codec specifications
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.polkadot.types.Codec

        toU8a
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • AbstractArray

        public AbstractArray()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Checks if the value is an empty value
        Specified by:
        isEmpty in interface Codec
        Specified by:
        isEmpty in interface java.util.Collection<T extends Codec>
        Specified by:
        isEmpty in interface java.util.List<T extends Codec>
        Overrides:
        isEmpty in class java.util.ArrayList<T extends Codec>
      • length

        public int length()
        The length of the value
      • getEncodedLength

        public int getEncodedLength()
        The length of the value when encoded as a Uint8Array
        Specified by:
        getEncodedLength in interface Codec
      • eq

        public boolean eq​(java.lang.Object other)
        Compares the value of the input to see if there is a match
        Specified by:
        eq in interface Codec
      • toHex

        public java.lang.String toHex()
        Returns a hex string representation of the value
        Specified by:
        toHex in interface Codec
      • toJson

        public java.lang.Object toJson()
        Converts the Object to JSON, typically used for RPC transfers
        Specified by:
        toJson in interface Codec
      • toU8a

        public byte[] toU8a​(boolean isBare)
        Encodes the value as a Uint8Array as per the parity-codec specifications
        Specified by:
        toU8a in interface Codec
        Parameters:
        isBare - true when the value has none of the type-specific prefixes (internal)
      • getFiled

        public <T> T getFiled​(int index)
        Parameters:
        callbackfn - The mapping function
        thisArg - The `this` onject to apply the result to Maps the array with the callback