|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joda.primitives.collection.impl.AbstractPrimitiveCollectable<Float> org.joda.primitives.collection.impl.AbstractFloatCollection org.joda.primitives.list.impl.AbstractFloatList org.joda.primitives.list.impl.ArrayFloatList
public class ArrayFloatList
Array based implementation of FloatList
for
primitive int
elements.
This class implements List
allowing
seamless integration with other APIs.
Add, Remove, Set and Clear are supported.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.joda.primitives.list.impl.AbstractFloatList |
---|
AbstractFloatList.PListIterator |
Constructor Summary | |
---|---|
ArrayFloatList()
Constructor. |
|
ArrayFloatList(Collection<Float> coll)
Constructor that copies the specified values. |
|
ArrayFloatList(float[] values)
Constructor that copies the specified values. |
|
ArrayFloatList(int initialSize)
Constructor that defines an initial size for the internal storage array. |
Method Summary | |
---|---|
boolean |
add(int index,
float value)
Adds a primitive value to this collection. |
boolean |
addAll(int index,
float[] values)
Adds an array of primitive values to this collection at a specified index. |
protected void |
arrayCopy(int fromIndex,
float[] dest,
int destIndex,
int size)
Copies data from this collection into the specified array. |
void |
clear()
Clears the collection/map of all elements. |
Object |
clone()
Clone implementation that calls Object clone(). |
boolean |
contains(float value)
Checks whether this collection contains a specified primitive value. |
protected void |
ensureCapacity(int capacity)
Ensures that the internal storage array has at least the specified size. |
float |
getFloat(int index)
Gets the primitive value at the specified index. |
protected boolean |
isAddModifiable()
Are the add methods supported. |
boolean |
isModifiable()
Checks whether the object can currently be modified. |
protected boolean |
isRemoveModifiable()
Are the remove methods supported. |
protected boolean |
isSetModifiable()
Are the remove methods supported. |
void |
optimize()
Optimizes the implementation. |
float |
removeFloatAt(int index)
Removes a primitive value by index from the list. |
boolean |
removeRange(int fromIndexInclusive,
int toIndexExclusive)
Removes a range of values from the list. |
float |
set(int index,
float value)
Sets the primitive value at a specified index. |
int |
size()
Gets the current size of the collection. |
Methods inherited from class org.joda.primitives.list.impl.AbstractFloatList |
---|
add, add, add, addAll, addAll, checkIndex, checkIndexExists, checkRange, checkSetModifiable, equals, first, firstFloat, get, hashCode, indexOf, indexOf, indexOf, indexOf, iterator, last, lastFloat, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeFloat, set, subList, toFloatArray |
Methods inherited from class org.joda.primitives.collection.impl.AbstractFloatCollection |
---|
addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toArray, toArray, toFloatArray, toFloatArray, toObject, toPrimitive, toPrimitiveArray, toString |
Methods inherited from class org.joda.primitives.collection.impl.AbstractPrimitiveCollectable |
---|
isEmpty |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
---|
containsAny |
Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
---|
isEmpty |
Methods inherited from interface java.util.List |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from interface org.joda.primitives.collection.FloatCollection |
---|
addAll, containsAll, containsAll, containsAny, containsAny, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, toFloatArray, toFloatArray |
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
---|
containsAny |
Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
---|
isEmpty |
Constructor Detail |
---|
public ArrayFloatList()
public ArrayFloatList(int initialSize)
initialSize
- the initial size of the internal array, negative treated as zeropublic ArrayFloatList(float[] values)
values
- an array of values to copy, null treated as zero size arraypublic ArrayFloatList(Collection<Float> coll)
coll
- a collection of values to copy, null treated as zero size collectionMethod Detail |
---|
public int size()
size
in interface Collection<Float>
size
in interface List<Float>
size
in interface PrimitiveCollectable<Float>
public float getFloat(int index)
getFloat
in interface FloatList
index
- the index to get from
IndexOutOfBoundsException
- if the index is invalidpublic boolean add(int index, float value)
add
in interface FloatList
add
in class AbstractFloatList
index
- the index to insert atvalue
- the value to add to this collection
true
if this collection was modified by this method call
IndexOutOfBoundsException
- if the index is invalidpublic float removeFloatAt(int index)
removeFloatAt
in interface FloatList
removeFloatAt
in class AbstractFloatList
index
- the index to remove from
IndexOutOfBoundsException
- if the index is invalidpublic boolean removeRange(int fromIndexInclusive, int toIndexExclusive)
removeRange
in interface PrimitiveList<Float>
removeRange
in class AbstractFloatList
fromIndexInclusive
- the start of the range to remove, inclusivetoIndexExclusive
- the end of the range to remove, exclusive
true
if the collection was modifiedpublic float set(int index, float value)
set
in interface FloatList
set
in class AbstractFloatList
index
- the index to setvalue
- the value to store
IndexOutOfBoundsException
- if the index is invalidpublic void optimize()
This implementation changes the internal array to be the same size as the size of the collection.
optimize
in interface PrimitiveCollectable<Float>
optimize
in class AbstractPrimitiveCollectable<Float>
public void clear()
This implementation resets the size, but does not reduce the internal storage array.
The collection/map will have a zero size after this method completes.
clear
in interface Collection<Float>
clear
in interface List<Float>
clear
in interface PrimitiveCollectable<Float>
clear
in class AbstractFloatList
public boolean contains(float value)
This implementation accesses the internal storage array directly.
contains
in interface FloatCollection
contains
in class AbstractFloatList
value
- the value to search for
true
if the value is foundpublic boolean addAll(int index, float[] values)
addAll
in interface FloatList
addAll
in class AbstractFloatList
index
- the index to add atvalues
- the values to add to this collection
true
if this collection was modified by this method call
IndexOutOfBoundsException
- if the index is invalidprotected boolean isAddModifiable()
isAddModifiable
in class AbstractFloatCollection
true
protected boolean isRemoveModifiable()
isRemoveModifiable
in class AbstractFloatCollection
true
protected boolean isSetModifiable()
isSetModifiable
in class AbstractFloatList
true
public boolean isModifiable()
isModifiable
in interface PrimitiveCollectable<Float>
isModifiable
in class AbstractFloatList
true
public Object clone()
clone
in interface PrimitiveCollectable<Float>
clone
in class AbstractPrimitiveCollectable<Float>
protected void arrayCopy(int fromIndex, float[] dest, int destIndex, int size)
arrayCopy
in class AbstractFloatList
fromIndex
- the index to start fromdest
- the destination arraydestIndex
- the destination start indexsize
- the number of items to copyprotected void ensureCapacity(int capacity)
capacity
- the amount to expand to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |