Class CharBigArrayBigList

All Implemented Interfaces:
BigList<Character>, CharBigList, CharCollection, CharIterable, CharStack, Size64, Stack<Character>, Serializable, Cloneable, Comparable<BigList<? extends Character>>, Iterable<Character>, Collection<Character>, RandomAccess

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

This class implements a lightweight, fast, open, optimized, reuse-oriented version of big-array-based big lists. Instances of this class represent a big list with a big array that is enlarged as needed when new entries are created (by doubling the current length), but is never made smaller (even on a clear()). A family of trimming methods lets you control the size of the backing big 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 big 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

    • CharBigArrayBigList

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

      public CharBigArrayBigList()
      Creates a new big-array big list with DEFAULT_INITIAL_CAPACITY capacity.
    • CharBigArrayBigList

      public CharBigArrayBigList​(CharCollection c)
      Creates a new big-array big 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.
    • CharBigArrayBigList

      public CharBigArrayBigList​(CharBigList l)
      Creates a new big-array big 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.
    • CharBigArrayBigList

      public CharBigArrayBigList​(char[][] a)
      Creates a new big-array big list and fills it with the elements of a given big array.

      Note that this constructor makes it easy to build big lists from literal arrays declared as type[][] {{ init_values }}. The only constraint is that the number of initialisation values is below BigArrays.SEGMENT_SIZE.

      Parameters:
      a - a big array whose elements will be used to fill the array list.
    • CharBigArrayBigList

      public CharBigArrayBigList​(char[][] a, long offset, long length)
      Creates a new big-array big list and fills it with the elements of a given big array.

      Note that this constructor makes it easy to build big lists from literal arrays declared as type[][] {{ init_values }}. The only constraint is that the number of initialisation values is below BigArrays.SEGMENT_SIZE.

      Parameters:
      a - a big array whose elements will be used to fill the array list.
      offset - the first element to use.
      length - the number of elements to use.
    • CharBigArrayBigList

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

      public CharBigArrayBigList​(CharIterator i)
      Creates a new big-array big 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