Package smile.util

Class FloatArrayList

java.lang.Object
smile.util.FloatArrayList
All Implemented Interfaces:
Serializable

public final class FloatArrayList extends Object implements Serializable
A resizeable, array-backed list of float primitives.
See Also:
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    void
    add(float val)
    Appends the specified value to the end of this list.
    void
    add(float[] vals)
    Appends an array to the end of this list.
    void
    Removes all the values 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.
    float
    get(int index)
    Returns the value at the specified position in this list.
    boolean
    Returns true if this list contains no values.
    float
    remove(int index)
    Removes the value at specified index from the list.
    void
    set(int index, float val)
    Replaces the value at the specified position in this list with the specified value.
    int
    Returns the number of values in the list.
    Returns the stream of the array list.
    float[]
    Returns an array containing all the values in this list in proper sequence (from first to last value).
    float[]
    toArray(float[] dest)
    Returns an array containing all the values in this list in proper sequence (from first to last value).
     
    void
    Trims the capacity to be the list's current size.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FloatArrayList

      public FloatArrayList()
      Constructs an empty list.
    • FloatArrayList

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

      public FloatArrayList(float[] values)
      Constructs a list containing the values of the specified array.
      Parameters:
      values - the initial values of array list.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • stream

      public DoubleStream stream()
      Returns the stream of the array list.
      Returns:
      the stream of the array list.
    • 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
    • trim

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

      public void add(float 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(float[] vals)
      Appends an array to the end of this list.
      Parameters:
      vals - an array to be appended to this list.
    • get

      public float 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 void set(int index, float 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:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
    • clear

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

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

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

      public float[] toArray(float[] dest)
      Returns an array containing all 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.