Class IntList


  • public class IntList
    extends PrimitiveList
    Extendable array of integers.
    Since:
    12 Oct 2006
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      IntList()
      Constructs a new list.
      IntList​(int size)
      Constructs a new list with a given initial capacity.
      IntList​(int[] array)
      Constructs a new list initialised to the contents of a given array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int value)
      Appends a value to the end of this list.
      boolean addAll​(IntList other)
      Appends all the elements of a second list to this list.
      int get​(int i)
      Returns the element at a given position.
      void set​(int i, int value)
      Sets the element at a given position.
      int[] toIntArray()
      Returns the contents of this list as an array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntList

        public IntList()
        Constructs a new list.
      • IntList

        public IntList​(int size)
        Constructs a new list with a given initial capacity.
        Parameters:
        size - initial capacity
      • IntList

        public IntList​(int[] array)
        Constructs a new list initialised to the contents of a given array.
        Parameters:
        array - array whose contents form initial contents of list
    • Method Detail

      • get

        public int get​(int i)
        Returns the element at a given position.
        Parameters:
        i - index
        Returns:
        element at i
      • set

        public void set​(int i,
                        int value)
        Sets the element at a given position.
        Parameters:
        i - index
        value - new value for element i
      • add

        public void add​(int value)
        Appends a value to the end of this list.
        Parameters:
        value - value to append
      • addAll

        public boolean addAll​(IntList other)
        Appends all the elements of a second list to this list.
        Parameters:
        other - other list
        Returns:
        true iff this collection changed as a result of the call
      • toIntArray

        public int[] toIntArray()
        Returns the contents of this list as an array.
        Returns:
        copy of list contents