Class SparseArrayList<T>

  • Type Parameters:
    T - the type of elements in the array
    All Implemented Interfaces:
    Iterable<T>, Collection<T>, List<T>, SparseList<T>

    public class SparseArrayList<T>
    extends AbstractList<T>
    implements SparseList<T>
    A sparse array backed by an ArrayList.

    This array uses a common encoding for sparse encoding such as CSR and CSC. Data points are stored in two vectors: elements and indices. To make operations efficient, the indices are kept in-order.

    Author:
    poirigui
    • Constructor Detail

      • SparseArrayList

        public SparseArrayList​(Collection<T> collection,
                               T defaultValue)
      • SparseArrayList

        public SparseArrayList​(Collection<T> collection)
        Create a new sparse array from a given collection, null is used as default value.
      • SparseArrayList

        public SparseArrayList​(List<T> array,
                               int[] indices,
                               int numberOfElements,
                               T defaultValue)
      • SparseArrayList

        public SparseArrayList​(List<T> array,
                               int[] indices,
                               int numberOfElements)
        Create a new sparse array, null is used as default value.
      • SparseArrayList

        public SparseArrayList()
        Create an empty sparse array.