Class BigArrayList<T>

java.lang.Object
com.complexible.common.collect.BigArrayList<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>

public final class BigArrayList<T> extends Object implements Iterable<T>

Simple implementation of a list that can have more than Integer.MAX_VALUE values. Works as a normal ArrayList until the size gets bigger than Integer.MAX_VALUE. After that, it works as a List of ArrayLists, so get(long) will be a little bit more expensive.

For now, only add(Object), get(long), and size() are supported.

Since:
2.0
Version:
2.0
Author:
Pedro Oliveira
  • Field Details

    • DEFAULT_MAX_SIZE

      public static final int DEFAULT_MAX_SIZE
      The default max size a List can have
      See Also:
  • Constructor Details

    • BigArrayList

      public BigArrayList()
  • Method Details

    • create

      public static <T> BigArrayList<T> create()
    • create

      public static <T> BigArrayList<T> create(int maxSize)
    • get

      public T get(long index)
      Returns the element at the specified position in this list.
      Parameters:
      index -
      Returns:
    • set

      public T set(long theIndex, T theElem)
      Set the value of the index
      Parameters:
      theIndex - the index
      theElem - the element to set at the index
      Returns:
      the value
    • add

      public boolean add(T element)
      Appends the specified element to the end of this list.
      Parameters:
      element -
      Returns:
    • size

      public long size()
      Returns the number of elements in this list.
      Returns:
    • clear

      public void clear()
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>