public class FloatList
extends java.lang.Object
FloatList represents a list of floats.
Class FloatList supports a clear() method, but does not
support a remove() method.| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_INIT_CAPACITY |
The default initial capacity of an
FloatList, which is 10. |
| Constructor | Description |
|---|---|
FloatList() |
Constructs an
FloatList object with the default
initial capacity. |
FloatList(int initCapacity) |
Constructs an
FloatList object with the specified
initial capacity. |
| 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 |
clear() |
Removes all elements from this list.
|
float |
get(int index) |
Returns the float at the specified position in this list.
|
boolean |
isEmpty() |
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 |
size() |
Returns the number of elements in this list.
|
float[] |
toArray() |
Returns an integer array containing the sequence of elements in this
list.
|
java.lang.String |
toString() |
Returns a string representation of this list.
|
public static final int DEFAULT_INIT_CAPACITY
FloatList, which is 10.public FloatList()
FloatList object with the default
initial capacity.DEFAULT_INIT_CAPACITYpublic FloatList(int initCapacity)
FloatList object with the specified
initial capacity.initCapacity - the initial capacity of this listjava.lang.IllegalArgumentException - if initCapacity<0.public void add(float element)
element - the value to be added to the end of this list.public void addToElement(int index,
float value)
index - the index of the element to which the specified value
will be addedvalue - the to be addedjava.lang.IndexOutOfBoundsException - if
index < 0 || index >= this.size()public float get(int index)
index - the index of the returned float.java.lang.IndexOutOfBoundsException - if
index < 0 || index >= this.size()public float set(int index,
float value)
index - the index of the element to be replacedvalue - the value to be stored at the specified position
in this listjava.lang.IndexOutOfBoundsException - if
index < 0 || index >= this.size()public int size()
public boolean isEmpty()
true if this list has no elements, and returns
false otherwise.true if this list has no elements, and returns
false otherwise.public float[] toArray()
public void clear()
public java.lang.String toString()
toString in class java.lang.Object