public class FloatArray extends Object
ArrayList<Float>. If unordered, this class avoids a memory copy when removing elements (the last element is moved to the removed element's position).
| Constructor and Description |
|---|
FloatArray()
Creates an ordered array with a capacity of 16.
|
FloatArray(boolean ordered, float[] array, int startIndex, int count)
Creates a new array containing the elements in the specified array.
|
FloatArray(boolean ordered, int capacity)
|
FloatArray(float[] array)
Creates a new ordered array containing the elements in the specified array.
|
FloatArray(FloatArray
Creates a new array containing the elements in the specific array.
|
FloatArray(int capacity)
Creates an ordered array with the specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(float value)
|
void |
addAll(float... array)
|
void |
addAll(float[] array, int offset, int length)
|
void |
addAll(FloatArray
|
void |
addAll(FloatArray
|
void |
clear()
|
boolean |
contains(float value)
|
float[] |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(Object
|
boolean |
equals(Object
|
float |
first()
Returns the first item.
|
float |
get(int index)
|
int |
hashCode()
|
void |
incr(int index, float value)
|
int |
indexOf(float value)
|
void |
insert(int index, float value)
|
int |
lastIndexOf(char value)
|
void |
mul(int index, float value)
|
float |
peek()
Returns the last item.
|
float |
pop()
Removes and returns the last item.
|
boolean |
removeAll(FloatArray
Removes from this array all of elements contained in the specified array.
|
float |
removeIndex(int index)
Removes and returns the item at the specified index.
|
void |
removeRange(int start, int end)
Removes the items between the specified indices, inclusive.
|
boolean |
removeValue(float value)
|
protected float[] |
resize(int newSize)
|
void |
reverse()
|
void |
set(int index, float value)
|
float[] |
setSize(int newSize)
Sets the array size, leaving any values beyond the current size undefined.
|
float[] |
shrink()
Reduces the size of the backing array to the size of the actual items.
|
void |
sort()
|
void |
swap(int first, int second)
|
float[] |
toArray()
|
String |
toString()
|
String |
toString(String
|
void |
truncate(int newSize)
Reduces the size of the array to the specified size.
|
static FloatArray |
with(float... array)
|
public FloatArray()
public FloatArray(int capacity)
public FloatArray(boolean ordered,
int capacity)
ordered - If false, methods that remove elements may change the order of other elements in the array, which avoids a memory copy.
capacity - Any elements added beyond this will cause the backing array to be grown.
public FloatArray(FloatArrayarray)
public FloatArray(float[] array)
public FloatArray(boolean ordered,
float[] array,
int startIndex,
int count)
ordered - If false, methods that remove elements may change the order of other elements in the array, which avoids a memory copy.
public void add(float value)
public void addAll(FloatArrayarray)
public void addAll(FloatArrayarray, int offset, int length)
public void addAll(float... array)
public void addAll(float[] array,
int offset,
int length)public float get(int index)
public void set(int index,
float value)public void incr(int index,
float value)public void mul(int index,
float value)public void insert(int index,
float value)public void swap(int first,
int second)public boolean contains(float value)
public int indexOf(float value)
public int lastIndexOf(char value)
public boolean removeValue(float value)
public float removeIndex(int index)
public void removeRange(int start,
int end)
public boolean removeAll(FloatArrayarray)
public float pop()
public float peek()
public float first()
public void clear()
public float[] shrink()
items
public float[] ensureCapacity(int additionalCapacity)
items
public float[] setSize(int newSize)
items
protected float[] resize(int newSize)
public void sort()
public void reverse()
public void truncate(int newSize)
public float[] toArray()
public int hashCode()
public boolean equals(Objectobject)
public boolean equals(Objectobject, float epsilon)
public StringtoString()
public static FloatArraywith(float... array)
FloatArray(float[])