Class FloatList


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

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

    Modifier and Type
    Method
    Description
    void
    add(float value)
    Appends a value to the end of this list.
    boolean
    addAll(float[] array)
    Appends all the elements of a primitive array to this list.
    boolean
    Appends all the elements of a second list to this list.
    float
    get(int i)
    Returns the element at a given position.
    float[]
    Returns the array currently used to store the contents of this list.
    void
    set(int i, float value)
    Sets the element at a given position.
    float[]
    Returns the contents of this list as an array.

    Methods inherited from class uk.ac.starlink.util.PrimitiveList

    clear, nextCapacity, size, toArray

    Methods inherited from class java.lang.Object

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

    • FloatList

      public FloatList()
      Constructs a new list.
    • FloatList

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

      public FloatList(float[] array)
      Constructs a new list initialised to the contents of a given array.
      Parameters:
      array - array whose contents form initial contents of list
  • Method Details

    • get

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

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

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

      public boolean addAll(FloatList 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
    • addAll

      public boolean addAll(float[] array)
      Appends all the elements of a primitive array to this list.
      Parameters:
      array - array to append
      Returns:
      true iff this collection changed as a result of the call
    • toFloatArray

      public float[] toFloatArray()
      Returns the contents of this list as an array.
      Returns:
      copy of list contents
    • getFloatBuffer

      public float[] getFloatBuffer()
      Returns the array currently used to store the contents of this list. Its length will be greater than or equal to the length of this list. The identity of the returned array may change as this list is mutated.
      Returns:
      storage array