Class AbstractPrimitiveArray<ArrayType,​BaseType>

  • Type Parameters:
    ArrayType - Type of the primitive array; e.g., double[].
    BaseType - Boxed type of the array element; e.g., Double.
    All Implemented Interfaces:
    Iterable<BaseType>, Collection<BaseType>, List<BaseType>, PrimitiveArray<ArrayType,​BaseType>
    Direct Known Subclasses:
    BoolArray, ByteArray, CharArray, DoubleArray, FloatArray, IntArray, LongArray, ObjectArray, ShortArray

    public abstract class AbstractPrimitiveArray<ArrayType,​BaseType>
    extends AbstractList<BaseType>
    implements PrimitiveArray<ArrayType,​BaseType>
    Abstract base class for primitive-type extensible arrays.

    This class makes it easy to implement extensible arrays backed by fixed-size primitive type arrays, re-allocating and copying data as needed. To avoid frequent re-allocation, by default, the fixed-size array will be expanded by 50% when running out of space.

    Author:
    Johannes Schindelin, Curtis Rueden
    • Constructor Detail

      • AbstractPrimitiveArray

        public AbstractPrimitiveArray​(Class<BaseType> type)
        Constructs an extensible array of primitive type elements, backed by a fixed-size array.
        Parameters:
        type - the class of the primitive type
      • AbstractPrimitiveArray

        public AbstractPrimitiveArray​(Class<BaseType> type,
                                      int size)
        Constructs an extensible array of primitive type elements, backed by a fixed-size array.
        Parameters:
        type - the class of the primitive type
        size - the initial size
      • AbstractPrimitiveArray

        public AbstractPrimitiveArray​(Class<BaseType> type,
                                      ArrayType array)
        Constructs an extensible array of primitive type elements, backed by the given fixed-size array.
        Parameters:
        array - the array to wrap
        type - the class of the primitive type