Package java.util

Class UnsafeArrayList<T>

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

public class UnsafeArrayList<T>
extends AbstractList<T>
An array-backed list that exposes its array.
  • Constructor Details

    • UnsafeArrayList

      public UnsafeArrayList​(Class<T> elementType, int initialCapacity)
  • Method Details

    • add

      public boolean add​(T element)
      Description copied from class: AbstractList
      Adds the specified object at the end of this List.
      Specified by:
      add in interface Collection<T>
      Specified by:
      add in interface List<T>
      Overrides:
      add in class AbstractList<T>
      Parameters:
      element - the object to add
      Returns:
      true
    • array

      public T[] array()
    • get

      public T get​(int i)
      Description copied from class: AbstractList
      Returns the element at the specified location in this list.
      Specified by:
      get in interface List<T>
      Specified by:
      get in class AbstractList<T>
      Parameters:
      i - the index of the element to return.
      Returns:
      the element at the specified index.
    • size

      public int size()
      Description copied from class: AbstractCollection
      Returns a count of how many objects this Collection contains.

      In this class this method is declared abstract and has to be implemented by concrete Collection implementations.

      Specified by:
      size in interface Collection<T>
      Specified by:
      size in interface List<T>
      Specified by:
      size in class AbstractCollection<T>
      Returns:
      how many objects this Collection contains, or Integer.MAX_VALUE if there are more than Integer.MAX_VALUE elements in this Collection.