|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.joda.primitives.collection.impl.AbstractPrimitiveCollectable<Float>
org.joda.primitives.collection.impl.AbstractFloatCollection
org.joda.primitives.list.impl.AbstractFloatList
public abstract class AbstractFloatList
Abstract base class for lists of primitive float
elements.
This class implements Collection
allowing
seamless integration with other APIs.
The get(int)
and size()
methods must be
implemented by subclases.
To make the subclass modifiable, the add(int, float)
,
removeIndex(int)
and set(int, float) must also be implemented.
Subclasses may override other methods to increase efficiency.
Nested Class Summary | |
---|---|
protected static class |
AbstractFloatList.PListIterator
List iterator. |
Constructor Summary | |
---|---|
protected |
AbstractFloatList()
Constructor. |
Method Summary | |
---|---|
boolean |
add(float value)
Adds a primitive value to this collection (optional operation). |
boolean |
add(Float value)
Adds the Float value to this collection (optional operation). |
boolean |
add(int index,
float value)
Adds a primitive value to this list at an index (optional operation). |
void |
add(int index,
Float value)
Adds the Float value to this list at an index (optional operation). |
boolean |
addAll(float[] values)
Adds an array of primitive values to this list at an index (optional operation). |
boolean |
addAll(int index,
Collection<? extends Float> coll)
Adds an array of Float values to this list at an index (optional operation). |
boolean |
addAll(int index,
float[] values)
Adds an array of primitive values to this list at an index (optional operation). |
protected void |
arrayCopy(int fromIndex,
float[] dest,
int destIndex,
int size)
Copies data from this collection into the specified array. |
protected void |
checkIndex(int index)
Checks whether an index is valid or not. |
protected void |
checkIndexExists(int index)
Checks whether an index is valid or not. |
protected void |
checkRange(int fromIndexInclusive,
int toIndexExclusive)
Checks whether a range is valid or not. |
protected void |
checkSetModifiable()
Check whether add is suported and throw an exception. |
void |
clear()
Clears the listof all elements (optional operation). |
boolean |
contains(float value)
Checks whether this collection contains a specified primitive value. |
boolean |
equals(Object obj)
Compares this list to another as per the contract of List . |
Float |
first()
Gets the first Float value. |
float |
firstFloat()
Gets the first primitive value. |
Float |
get(int index)
Gets the Float value at the specified index. |
int |
hashCode()
Gets the hashCode of this list as per the contract of List . |
int |
indexOf(float value)
Gets the first index of the specified primitive value. |
int |
indexOf(float value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
int |
indexOf(Object value)
Gets the first index of the specified Float value. |
int |
indexOf(Object value,
int fromIndexInclusive)
Gets the first index of the specified Float value from an index. |
boolean |
isModifiable()
Is the collection modifiable in any way. |
protected boolean |
isSetModifiable()
Are the set methods supported. |
FloatListIterator |
iterator()
Gets an iterator over this list. |
Float |
last()
Gets the last Float value. |
float |
lastFloat()
Gets the last primitive value. |
int |
lastIndexOf(float value)
Gets the last index of the specified primitive value. |
int |
lastIndexOf(float value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
int |
lastIndexOf(Object value)
Gets the last index of the specified Float value. |
int |
lastIndexOf(Object value,
int fromIndexInclusive)
Gets the first index of the specified Float value from an index. |
FloatListIterator |
listIterator()
Gets a list iterator over this list. |
FloatListIterator |
listIterator(int index)
Gets a list iterator over this list from a start index. |
Float |
remove(int index)
Deprecated. This method should only be used when working with List and not when working with FloatList - use removeFloatAt(int) |
boolean |
removeFloat(float value)
Removes the first occurrence of a primitive value from the list (optional operation). |
float |
removeFloatAt(int index)
Removes a primitive value by index from the list (optional operation). |
boolean |
removeRange(int fromIndexInclusive,
int toIndexExclusive)
Removes a range of values from the list (optional operation). |
float |
set(int index,
float value)
Sets the primitive value at a specified index. |
Float |
set(int index,
Float value)
Sets the Float value at a specified index. |
FloatList |
subList(int fromIndexInclusive,
int toIndexExclusive)
Gets a range view of part of this list. |
float[] |
toFloatArray(int fromIndexInclusive,
int toIndexExclusive)
Gets a range of elements as an array. |
Methods inherited from class org.joda.primitives.collection.impl.AbstractFloatCollection |
---|
addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, isAddModifiable, isRemoveModifiable, 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 |
---|
clone, isEmpty, optimize |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.joda.primitives.list.FloatList |
---|
getFloat |
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
---|
containsAny |
Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
---|
clone, isEmpty, optimize, size |
Methods inherited from interface java.util.List |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, 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 |
---|
clone, isEmpty, optimize, size |
Constructor Detail |
---|
protected AbstractFloatList()
Method Detail |
---|
public FloatListIterator iterator()
iterator
in interface Iterable<Float>
iterator
in interface Collection<Float>
iterator
in interface List<Float>
iterator
in interface FloatCollection
iterator
in interface FloatIterable
iterator
in interface FloatList
public FloatListIterator listIterator()
This implementation uses floatListIterator(int)
.
listIterator
in interface List<Float>
listIterator
in interface FloatList
public FloatListIterator listIterator(int index)
listIterator
in interface List<Float>
listIterator
in interface FloatList
index
- the index to start from
IndexOutOfBoundsException
- if the index is invalidpublic float firstFloat()
firstFloat
in interface FloatList
IndexOutOfBoundsException
- if the size is zeropublic float lastFloat()
lastFloat
in interface FloatList
size() - 1
IndexOutOfBoundsException
- if the size is zeropublic boolean contains(float value)
This implementation uses getFloat(int)
.
contains
in interface FloatCollection
contains
in class AbstractFloatCollection
value
- the value to search for
true
if the value is foundpublic int indexOf(float value)
This implementation uses indexof(float, int)
.
indexOf
in interface FloatList
value
- the value to search for
-1
if not foundpublic int indexOf(float value, int fromIndexInclusive)
This method follows the conventions of String
in that a
negative index is treated as zero, and an index greater than the list
size will simply return -1
.
This implementation uses get(int)
.
indexOf
in interface FloatList
value
- the value to search forfromIndexInclusive
- the index to start searching from, inclusive
-1
if not foundpublic int lastIndexOf(float value)
This implementation uses lastIndexof(float, int)
.
lastIndexOf
in interface FloatList
value
- the value to search for
-1
if not foundpublic int lastIndexOf(float value, int fromIndexInclusive)
This method follows the conventions of String
in that an
index greater than the list size will start searching at the list size,
and a negative index simply returns -1
.
This implementation uses get(int)
.
lastIndexOf
in interface FloatList
value
- the value to search forfromIndexInclusive
- the index to start searching from, inclusive
-1
if not foundpublic float[] toFloatArray(int fromIndexInclusive, int toIndexExclusive)
toFloatArray
in interface FloatList
fromIndexInclusive
- the index to start from, inclusivetoIndexExclusive
- the index to end at, exclusive
IndexOutOfBoundsException
- if either index is invalidpublic FloatList subList(int fromIndexInclusive, int toIndexExclusive)
This method allows operations to work on a range within the greater list. Changes made to the either object will affect the other.
subList
in interface List<Float>
subList
in interface FloatList
fromIndexInclusive
- the index to start from, inclusivetoIndexExclusive
- the index to end at, exclusive
IndexOutOfBoundsException
- if either index is invalidpublic void clear()
This implementation uses removeRange(int, int)
.
clear
in interface Collection<Float>
clear
in interface List<Float>
clear
in interface PrimitiveCollectable<Float>
clear
in class AbstractFloatCollection
UnsupportedOperationException
- if method not supported by this collectionpublic boolean add(float value)
This implementation uses add(int, float)
.
add
in interface FloatCollection
add
in class AbstractFloatCollection
value
- the value to add to this collection
true
if this collection was modified by this method call
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic boolean add(int index, float value)
This implementation throws UnsupportedOperationException.
add
in interface FloatList
index
- the index to add atvalue
- the value to add to this collection
true
if this list was modified by this method call
IndexOutOfBoundsException
- if the index is invalid
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic boolean addAll(float[] values)
This implementation uses addAll(int, float)
.
addAll
in interface FloatCollection
addAll
in class AbstractFloatCollection
values
- the values to add to this collection, null treated as empty array
true
if this list was modified by this method call
IndexOutOfBoundsException
- if the index is invalid
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic boolean addAll(int index, float[] values)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
addAll
in interface FloatList
index
- the index to add atvalues
- the values to add to this collection, null treated as empty array
true
if this list was modified by this method call
IndexOutOfBoundsException
- if the index is invalid
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic float removeFloatAt(int index)
This implementation throws UnsupportedOperationException.
removeFloatAt
in interface FloatList
index
- the index to remove from
IndexOutOfBoundsException
- if the index is invalid
UnsupportedOperationException
- if not supported by this collectionpublic boolean removeFloat(float value)
This implementation uses get(int)
and removeFloatAt(int)
.
value
- the value to remove
UnsupportedOperationException
- if not supported by this collectionpublic boolean removeRange(int fromIndexInclusive, int toIndexExclusive)
This implementation uses removeFloatAt(int)
.
removeRange
in interface PrimitiveList<Float>
fromIndexInclusive
- the start of the range to remove, inclusivetoIndexExclusive
- the end of the range to remove, exclusive
true
if the collection was modified
IndexOutOfBoundsException
- if the index is invalid
UnsupportedOperationException
- if remove is not supportedpublic float set(int index, float value)
This implementation throws UnsupportedOperationException.
set
in interface FloatList
index
- the index to setvalue
- the value to store
IndexOutOfBoundsException
- if the index is invalid
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic Float get(int index)
Float
value at the specified index.
get
in interface List<Float>
index
- the index to get from
IndexOutOfBoundsException
- if the index is invalidpublic Float first()
Float
value.
first
in interface PrimitiveList<Float>
public Float last()
Float
value.
last
in interface PrimitiveList<Float>
size() - 1
or null if the size is zeropublic int indexOf(Object value)
Float
value.
indexOf
in interface List<Float>
value
- the value to search for
-1
if not found
NullPointerException
- if the value if null
ClassCastException
- if the object is not Float
public int indexOf(Object value, int fromIndexInclusive)
Float
value from an index.
This method follows the conventions of String
in that a
negative index is treated as zero, and an index greater than the list
size will simply return -1
.
value
- the value to search forfromIndexInclusive
- the index to start searching from, inclusive
-1
if not found
NullPointerException
- if the value if null
ClassCastException
- if the object is not Float
public int lastIndexOf(Object value)
Float
value.
lastIndexOf
in interface List<Float>
value
- the value to search for
-1
if not found
NullPointerException
- if the value if null
ClassCastException
- if the object is not Float
public int lastIndexOf(Object value, int fromIndexInclusive)
Float
value from an index.
This method follows the conventions of String
in that an
index greater than the list size will start searching at the list size,
and a negative index simply returns -1
.
value
- the value to search forfromIndexInclusive
- the index to start searching from, inclusive
-1
if not found
NullPointerException
- if the value if null
ClassCastException
- if the object is not Float
public boolean add(Float value)
Float
value to this collection (optional operation).
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
add
in interface Collection<Float>
add
in interface List<Float>
add
in class AbstractFloatCollection
value
- the value to add to this collection
true
if this collection was modified by this method call
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic void add(int index, Float value)
Float
value to this list at an index (optional operation).
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
add
in interface List<Float>
index
- the index to add atvalue
- the value to add to this collection
IndexOutOfBoundsException
- if the index is invalid
ClassCastException
- if the object is not Float
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic boolean addAll(int index, Collection<? extends Float> coll)
Float
values to this list at an index (optional operation).
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
addAll
in interface List<Float>
index
- the index to add atcoll
- the values to add to this collection
true
if this list was modified by this method call
IndexOutOfBoundsException
- if the index is invalid
ClassCastException
- if any object is not Float
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic Float remove(int index)
removeFloatAt(int)
This implementation uses removeFloatAt(int)
.
remove
in interface List<Float>
remove
in interface FloatList
index
- the index to remove from
IndexOutOfBoundsException
- if the index is invalid
UnsupportedOperationException
- if not supported by this collectionpublic Float set(int index, Float value)
Float
value at a specified index.
This implementation uses set(int, float)
.
set
in interface List<Float>
index
- the index to setvalue
- the value to store
IndexOutOfBoundsException
- if the index is invalid
IllegalArgumentException
- if value is rejected by this collection
UnsupportedOperationException
- if not supported by this collectionpublic boolean equals(Object obj)
List
.
equals
in interface Collection<Float>
equals
in interface List<Float>
equals
in class Object
obj
- the object to compare to
true
if the lists are equalpublic int hashCode()
List
.
hashCode
in interface Collection<Float>
hashCode
in interface List<Float>
hashCode
in class Object
protected void arrayCopy(int fromIndex, float[] dest, int destIndex, int size)
arrayCopy
in class AbstractFloatCollection
fromIndex
- the index to start fromdest
- the destination arraydestIndex
- the destination start indexsize
- the number of items to copyprotected boolean isSetModifiable()
This implementation returns false.
public boolean isModifiable()
isModifiable
in interface PrimitiveCollectable<Float>
isModifiable
in class AbstractFloatCollection
protected void checkSetModifiable()
protected void checkIndexExists(int index)
index
- the index to check
IndexOutOfBoundsException
- if either index is invalidprotected void checkIndex(int index)
index
- the index to check
IndexOutOfBoundsException
- if either index is invalidprotected void checkRange(int fromIndexInclusive, int toIndexExclusive)
fromIndexInclusive
- the index to start from, inclusivetoIndexExclusive
- the index to end at, exclusive
IndexOutOfBoundsException
- if either index is invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |