Interface ArrayType<T>

All Superinterfaces:
Serializable
All Known Implementing Classes:
ArrayType.BooleanArrayType, ArrayType.ByteArrayType, ArrayType.CharArrayType, ArrayType.DoubleArrayType, ArrayType.FloatArrayType, ArrayType.IntArrayType, ArrayType.LongArrayType, ArrayType.ObjectArrayType, ArrayType.ShortArrayType

interface ArrayType<T> extends Serializable
Helper to replace reflective array access.
  • Field Details

  • Method Details

    • obj

      static <T> ArrayType<T> obj()
    • type

      Class<T> type()
    • lengthOf

      int lengthOf(Object array)
    • getAt

      T getAt(Object array, int index)
    • empty

      Object empty()
    • setAt

      void setAt(Object array, int index, T value) throws ClassCastException
      Throws:
      ClassCastException
    • copy

      Object copy(Object array, int arraySize, int sourceFrom, int destinationFrom, int size)
    • of

      static <T> ArrayType<T> of(Object array)
    • of

      static <T> ArrayType<T> of(Class<T> type)
    • ofPrimitive

      static <T> ArrayType<T> ofPrimitive(Class<T> type)
    • newInstance

      default Object newInstance(int length)
    • copyRange

      default Object copyRange(Object array, int from, int to)
      System.arrayCopy with same source and destination
    • grouped

      default Object grouped(Object array, int groupSize)
      Repeatedly group an array into equal sized sub-trees
    • copyUpdate

      default Object copyUpdate(Object array, int index, T element)
      clone the source and set the value at the given position
    • copy

      default Object copy(Object array, int minLength)
    • copyDrop

      default Object copyDrop(Object array, int index)
      clone the source and keep everything after the index (pre-padding the values with null)
    • copyTake

      default Object copyTake(Object array, int lastIndex)
      clone the source and keep everything before and including the index
    • asArray

      default Object asArray(T element)
      Create a single element array
    • asArray

      static Object[] asArray(Iterator<?> it, int length)
      Store the content of an iterable in an array
    • asPrimitives

      static <T> T asPrimitives(Class<?> primitiveClass, Iterable<?> values)