Class BooleanArrayList

All Implemented Interfaces:
BooleanCollection, BooleanIterable, BooleanList, BooleanStack, Stack<Boolean>, Serializable, Cloneable, Comparable<List<? extends Boolean>>, Iterable<Boolean>, Collection<Boolean>, List<Boolean>, RandomAccess

public class BooleanArrayList
extends AbstractBooleanList
implements RandomAccess, Cloneable, Serializable
A type-specific array-based list; provides some additional methods that use polymorphism to avoid (un)boxing.

This class implements a lightweight, fast, open, optimized, reuse-oriented version of array-based lists. Instances of this class represent a list with an array that is enlarged as needed when new entries are created (by doubling its current length), but is never made smaller (even on a clear()). A family of trimming methods lets you control the size of the backing array; this is particularly useful if you reuse instances of this class. Range checks are equivalent to those of java.util's classes, but they are delayed as much as possible. The backing array is exposed by the elements() method.

This class implements the bulk methods removeElements(), addElements() and getElements() using high-performance system calls (e.g., System.arraycopy() instead of expensive loops.

See Also:
ArrayList, Serialized Form
  • Field Details

  • Constructor Details

    • BooleanArrayList

      public BooleanArrayList​(int capacity)
      Creates a new array list with given capacity.
      Parameters:
      capacity - the initial capacity of the array list (may be 0).
    • BooleanArrayList

      public BooleanArrayList()
      Creates a new array list with DEFAULT_INITIAL_CAPACITY capacity.
    • BooleanArrayList

      public BooleanArrayList​(Collection<? extends Boolean> c)
      Creates a new array list and fills it with a given collection.
      Parameters:
      c - a collection that will be used to fill the array list.
    • BooleanArrayList

      public BooleanArrayList​(BooleanCollection c)
      Creates a new array list and fills it with a given type-specific collection.
      Parameters:
      c - a type-specific collection that will be used to fill the array list.
    • BooleanArrayList

      public BooleanArrayList​(BooleanList l)
      Creates a new array list and fills it with a given type-specific list.
      Parameters:
      l - a type-specific list that will be used to fill the array list.
    • BooleanArrayList

      public BooleanArrayList​(boolean[] a)
      Creates a new array list and fills it with the elements of a given array.
      Parameters:
      a - an array whose elements will be used to fill the array list.
    • BooleanArrayList

      public BooleanArrayList​(boolean[] a, int offset, int length)
      Creates a new array list and fills it with the elements of a given array.
      Parameters:
      a - an array whose elements will be used to fill the array list.
      offset - the first element to use.
      length - the number of elements to use.
    • BooleanArrayList

      public BooleanArrayList​(Iterator<? extends Boolean> i)
      Creates a new array list and fills it with the elements returned by an iterator..
      Parameters:
      i - an iterator whose returned elements will fill the array list.
    • BooleanArrayList

      public BooleanArrayList​(BooleanIterator i)
      Creates a new array list and fills it with the elements returned by a type-specific iterator..
      Parameters:
      i - a type-specific iterator whose returned elements will fill the array list.
  • Method Details