Class BulkArrayList<T>

  • All Implemented Interfaces:

    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.

    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.
        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.
        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.
        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.
        index - the index
        the value at the given index
        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.
        the number of elements in the list
      • toArray

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