Interface ArrayType<T>

Type Parameters:
T -
All Known Subinterfaces:
PrimitiveArrayType<T>
All Known Implementing Classes:
PrimitiveArrayType.Booleans, PrimitiveArrayType.Bytes, PrimitiveArrayType.Chars, PrimitiveArrayType.Doubles, PrimitiveArrayType.Floats, PrimitiveArrayType.Ints, PrimitiveArrayType.Longs, PrimitiveArrayType.Shorts

public interface ArrayType<T>
A utility interface that allows strongly typed access to an array.
See Also:
  • Method Details

    • getArrayType

      Class<T> getArrayType()
    • isAssignableFrom

      default boolean isAssignableFrom(Class<?> clazz)
    • isAssignableFromObject

      default boolean isAssignableFromObject(Object o)
    • getLength

      int getLength(T array)
      A strongly-typed equivalent to Array.getLength(Object).
      Parameters:
      array - the array
      Returns:
      the length of the array
    • newInstance

      T newInstance(int len)
      A strongly-typed equivalent to Array.newInstance(Class, int).
      Parameters:
      len - the length of the new array
      Returns:
      the new array
    • arrayCopy

      void arrayCopy(T src, int srcPos, T dest, int destPos, int length)
      A strongly-typed equivalent to System.arraycopy(Object, int, Object, int, int).
      Parameters:
      src - the source array.
      srcPos - starting position in the source array.
      dest - the destination array.
      destPos - starting position in the destination data.
      length - the number of array elements to be copied.
    • copyOfRange

      default T copyOfRange(T src, int from, int to)
      A strongly-typed equivalent to Arrays.copyOfRange(Object[], int, int).
      Parameters:
      src - the array from which a range is to be copied
      from - the initial index of the range to be copied, inclusive
      to - the final index of the range to be copied, exclusive
      Returns:
      a new array containing the specified range from the original array