Package blbutil

Class FloatList

java.lang.Object
blbutil.FloatList

public class FloatList extends Object
Class FloatList represents a list of floats. Class FloatList supports a clear() method, but does not support a remove() method.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default initial capacity of an FloatList, which is 10.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an FloatList object with the default initial capacity.
    FloatList(int initCapacity)
    Constructs an FloatList object with the specified initial capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(float element)
    Adds the specified integer to the end of this list.
    void
    addToElement(int index, float value)
    Adds the specified value to the specified element.
    void
    Removes all elements from this list.
    float
    get(int index)
    Returns the float at the specified position in this list.
    boolean
    Returns true if this list has no elements, and returns false otherwise.
    float
    set(int index, float value)
    Replaces the element at the specified position in this list with the specified element.
    int
    Returns the number of elements in this list.
    float[]
    Returns an integer array containing the sequence of elements in this list.
    Returns a string representation of this list.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_INIT_CAPACITY

      public static final int DEFAULT_INIT_CAPACITY
      The default initial capacity of an FloatList, which is 10.
      See Also:
  • Constructor Details

    • FloatList

      public FloatList()
      Constructs an FloatList object with the default initial capacity.
      See Also:
    • FloatList

      public FloatList(int initCapacity)
      Constructs an FloatList object with the specified initial capacity.
      Parameters:
      initCapacity - the initial capacity of this list
      Throws:
      IllegalArgumentException - if initCapacity<0.
  • Method Details

    • add

      public void add(float element)
      Adds the specified integer to the end of this list.
      Parameters:
      element - the value to be added to the end of this list.
    • addToElement

      public void addToElement(int index, float value)
      Adds the specified value to the specified element.
      Parameters:
      index - the index of the element to which the specified value will be added
      value - the to be added
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.size()
    • get

      public float get(int index)
      Returns the float at the specified position in this list.
      Parameters:
      index - the index of the returned float.
      Returns:
      the float at the specified position in this list.
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.size()
    • set

      public float set(int index, float value)
      Replaces the element at the specified position in this list with the specified element.
      Parameters:
      index - the index of the element to be replaced
      value - the value to be stored at the specified position in this list
      Returns:
      the previous value at the specified position in this list
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.size()
    • size

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

      public boolean isEmpty()
      Returns true if this list has no elements, and returns false otherwise.
      Returns:
      true if this list has no elements, and returns false otherwise.
    • toArray

      public float[] toArray()
      Returns an integer array containing the sequence of elements in this list.
      Returns:
      an integer array containing the sequence of elements in this list.
    • clear

      public void clear()
      Removes all elements from this list.
    • toString

      public String toString()
      Returns a string representation of this list. The exact details of the representation are unspecified and subject to change.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this list.