Class LinkedArrayList

java.lang.Object
io.reactivex.rxjava3.internal.util.LinkedArrayList

public class LinkedArrayList extends Object
A list implementation which combines an ArrayList with a LinkedList to avoid copying values when the capacity needs to be increased.

The class is non final to allow embedding it directly and thus saving on object allocation.

  • Constructor Details

    • LinkedArrayList

      public LinkedArrayList(int capacityHint)
      Constructor with the capacity hint of each array segment.
      Parameters:
      capacityHint - the expected number of elements to hold (can grow beyond that)
  • Method Details

    • add

      public void add(Object o)
      Adds a new element to this list.
      Parameters:
      o - the object to add, nulls are accepted
    • head

      public Object[] head()
      Returns the head buffer segment or null if the list is empty.
      Returns:
      the head object array
    • size

      public int size()
      Returns the total size of the list.
      Returns:
      the total size of the list
    • toString

      public String toString()
      Overrides:
      toString in class Object