Documentation of 'smile.math.IntArrayList' Java class
IntArrayList
smile.math

Class IntArrayList

  • All Implemented Interfaces:
    java.io.Serializable


    public final class IntArrayList
    extends java.lang.Object
    implements java.io.Serializable
    A resizeable, array-backed list of integer primitives.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      IntArrayList()
      Constructs an empty list.
      IntArrayList(int capacity)
      Constructs an empty list with the specified initial capacity.
      IntArrayList(int[] values)
      Constructs a list containing the values of the specified array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void add(int val)
      Appends the specified value to the end of this list.
      void add(int[] vals)
      Appends an array to the end of this list.
      void clear()
      Removes all of the value from this list.
      void ensureCapacity(int capacity)
      Increases the capacity, if necessary, to ensure that it can hold at least the number of values specified by the minimum capacity argument.
      int get(int index)
      Returns the value at the specified position in this list.
      boolean isEmpty()
      Returns true if this list contains no values.
      int remove(int index)
      Removes the value at specified index from the list.
      IntArrayList set(int index, int val)
      Replaces the value at the specified position in this list with the specified value.
      int size()
      Returns the number of values in the list.
      int[] toArray()
      Returns an array containing all of the values in this list in proper sequence (from first to last value).
      int[] toArray(int[] dest)
      Returns an array containing all of the values in this list in proper sequence (from first to last value).
      void trimToSize()
      Trims the capacity to be the list's current size.
      • Methods inherited from class java.lang.Object

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

      • IntArrayList

        public IntArrayList()
        Constructs an empty list.
      • IntArrayList

        public IntArrayList(int capacity)
        Constructs an empty list with the specified initial capacity.
        Parameters:
        capacity - the initial size of array list.
      • IntArrayList

        public IntArrayList(int[] values)
        Constructs a list containing the values of the specified array.
        Parameters:
        values - the initial values of array list.
    • Method Detail

      • ensureCapacity

        public void ensureCapacity(int capacity)
        Increases the capacity, if necessary, to ensure that it can hold at least the number of values specified by the minimum capacity argument.
        Parameters:
        capacity - the desired minimum capacity.
      • size

        public int size()
        Returns the number of values in the list.
        Returns:
        the number of values in the list
      • isEmpty

        public boolean isEmpty()
        Returns true if this list contains no values.
        Returns:
        true if the list is empty
      • trimToSize

        public void trimToSize()
        Trims the capacity to be the list's current size.
      • add

        public void add(int val)
        Appends the specified value to the end of this list.
        Parameters:
        val - a value to be appended to this list.
      • add

        public void add(int[] vals)
        Appends an array to the end of this list.
        Parameters:
        vals - an array to be appended to this list.
      • get

        public int get(int index)
        Returns the value at the specified position in this list.
        Parameters:
        index - index of the value to return
        Returns:
        the value at the specified position in this list
      • set

        public IntArrayList set(int index,
                                int val)
        Replaces the value at the specified position in this list with the specified value.
        Parameters:
        index - index of the value to replace
        val - value to be stored at the specified position
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index ≥ size())
      • clear

        public void clear()
        Removes all of the value from this list. The list will be empty after this call returns.
      • remove

        public int remove(int index)
        Removes the value at specified index from the list.
        Parameters:
        index - index of the element to remove.
        Returns:
        the value previously stored at specified index
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index ≥ size())
      • toArray

        public int[] toArray()
        Returns an array containing all of the values in this list in proper sequence (from first to last value). The caller is thus free to modify the returned array.
      • toArray

        public int[] toArray(int[] dest)
        Returns an array containing all of the values in this list in proper sequence (from first to last value). If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the size of this list.
        Parameters:
        dest - the array into which the values of the list are to be stored, if it is big enough; otherwise, a new array is allocated for this purpose.
        Returns:
        an array containing the values of the list

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.