Class BulkArrayList<T>

  • All Implemented Interfaces:
    Cloneable

    public class BulkArrayList<T>
    extends Object
    implements Cloneable
    An Array-List with a linear instead of exponential growth.

    This list is not synchronized and does not implement the full List interface. In fact, this list can only be used to add new values or to clear the complete list.

    Author:
    Thomas Morgner
    • Constructor Detail

      • BulkArrayList

        public BulkArrayList​(int capacity)
        Creates a new IntList with the given initial capacity. The capacity will also be used as increment value when extending the capacity of the list.
        Parameters:
        capacity - the initial capacity.
      • BulkArrayList

        public BulkArrayList​(T[] data,
                             int increment)
    • Method Detail

      • add

        public void add​(T value)
        Adds the given int value to the list.
        Parameters:
        value - the new value to be added.
      • remove

        public void remove​(int index)
      • set

        public void set​(int index,
                        T value)
        Adds the given int value to the list.
        Parameters:
        value - the new value to be defined.
        index - the position of the valur that should be redefined.
      • removeRange

        public void removeRange​(int index,
                                int count)
      • get

        public T get​(int index)
        Returns the value at the given index.
        Parameters:
        index - the index
        Returns:
        the value at the given index
        Throws:
        IndexOutOfBoundsException - if the index is greater or equal to the list size or if the index is negative.
      • clear

        public void clear()
        Clears the list.
      • size

        public int size()
        Returns the number of elements in this list.
        Returns:
        the number of elements in the list
      • toArray

        public <T> T[] toArray​(T[] retval)
        Copys the list contents into a new array.
        Parameters:
        retval - the array that should receive the contents.
        Returns:
        the list contents as array.