Class UnmodifiableArrayList<T>

All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>, RandomAccess

public class UnmodifiableArrayList<T> extends AbstractList<T> implements RandomAccess
An unmodifiable array-based List implementation. This is essentially like the package private UnmodifiableRandomAccessList of the JDK, and helps us to avoid having to do a lot of conversion work when we want to pass an array into an unmodifiable list implementation (otherwise we would have to create a temporary list that is then passed to Collections.unmodifiableList).
  • Constructor Details

    • UnmodifiableArrayList

      public UnmodifiableArrayList(T[] elements, int size)
      The given elements are used directly (a defensive copy is not made), and the given size is used as the size of this list. It is the callers responsibility to make sure the size is accurate.
      elements - The elements to use.
      size - The size must be invalid input: '<'= the length of the elements array
  • Method Details