|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.joda.primitives.collection.impl.AbstractPrimitiveCollectable<Double>
org.joda.primitives.collection.impl.AbstractDoubleCollection
org.joda.primitives.list.impl.AbstractDoubleList
public abstract class AbstractDoubleList
Abstract base class for lists of primitive double 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, double),
removeIndex(int) and set(int, double) must also be implemented.
Subclasses may override other methods to increase efficiency.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractDoubleList.PListIterator
List iterator. |
| Constructor Summary | |
|---|---|
protected |
AbstractDoubleList()
Constructor. |
| Method Summary | |
|---|---|
boolean |
add(double value)
Adds a primitive value to this collection (optional operation). |
boolean |
add(Double value)
Adds the Double value to this collection (optional operation). |
boolean |
add(int index,
double value)
Adds a primitive value to this list at an index (optional operation). |
void |
add(int index,
Double value)
Adds the Double value to this list at an index (optional operation). |
boolean |
addAll(double[] values)
Adds an array of primitive values to this list at an index (optional operation). |
boolean |
addAll(int index,
Collection<? extends Double> coll)
Adds an array of Double values to this list at an index (optional operation). |
boolean |
addAll(int index,
double[] values)
Adds an array of primitive values to this list at an index (optional operation). |
protected void |
arrayCopy(int fromIndex,
double[] 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(double 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. |
Double |
first()
Gets the first Double value. |
double |
firstDouble()
Gets the first primitive value. |
Double |
get(int index)
Gets the Double value at the specified index. |
int |
hashCode()
Gets the hashCode of this list as per the contract of List. |
int |
indexOf(double value)
Gets the first index of the specified primitive value. |
int |
indexOf(double 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 Double value. |
int |
indexOf(Object value,
int fromIndexInclusive)
Gets the first index of the specified Double value from an index. |
boolean |
isModifiable()
Is the collection modifiable in any way. |
protected boolean |
isSetModifiable()
Are the set methods supported. |
DoubleListIterator |
iterator()
Gets an iterator over this list. |
Double |
last()
Gets the last Double value. |
double |
lastDouble()
Gets the last primitive value. |
int |
lastIndexOf(double value)
Gets the last index of the specified primitive value. |
int |
lastIndexOf(double 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 Double value. |
int |
lastIndexOf(Object value,
int fromIndexInclusive)
Gets the first index of the specified Double value from an index. |
DoubleListIterator |
listIterator()
Gets a list iterator over this list. |
DoubleListIterator |
listIterator(int index)
Gets a list iterator over this list from a start index. |
Double |
remove(int index)
Deprecated. This method should only be used when working with List and not when working with DoubleList - use removeDoubleAt(int) |
boolean |
removeDouble(double value)
Removes the first occurrence of a primitive value from the list (optional operation). |
double |
removeDoubleAt(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). |
double |
set(int index,
double value)
Sets the primitive value at a specified index. |
Double |
set(int index,
Double value)
Sets the Double value at a specified index. |
DoubleList |
subList(int fromIndexInclusive,
int toIndexExclusive)
Gets a range view of part of this list. |
double[] |
toDoubleArray(int fromIndexInclusive,
int toIndexExclusive)
Gets a range of elements as an array. |
| Methods inherited from class org.joda.primitives.collection.impl.AbstractDoubleCollection |
|---|
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, toDoubleArray, toDoubleArray, 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.DoubleList |
|---|
getDouble |
| 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.DoubleCollection |
|---|
addAll, containsAll, containsAll, containsAny, containsAny, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, toDoubleArray, toDoubleArray |
| 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 AbstractDoubleList()
| Method Detail |
|---|
public DoubleListIterator iterator()
iterator in interface Iterable<Double>iterator in interface Collection<Double>iterator in interface List<Double>iterator in interface DoubleCollectioniterator in interface DoubleIterableiterator in interface DoubleListpublic DoubleListIterator listIterator()
This implementation uses doubleListIterator(int).
listIterator in interface List<Double>listIterator in interface DoubleListpublic DoubleListIterator listIterator(int index)
listIterator in interface List<Double>listIterator in interface DoubleListindex - the index to start from
IndexOutOfBoundsException - if the index is invalidpublic double firstDouble()
firstDouble in interface DoubleListIndexOutOfBoundsException - if the size is zeropublic double lastDouble()
lastDouble in interface DoubleListsize() - 1
IndexOutOfBoundsException - if the size is zeropublic boolean contains(double value)
This implementation uses getDouble(int).
contains in interface DoubleCollectioncontains in class AbstractDoubleCollectionvalue - the value to search for
true if the value is foundpublic int indexOf(double value)
This implementation uses indexof(double, int).
indexOf in interface DoubleListvalue - the value to search for
-1 if not found
public int indexOf(double 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 DoubleListvalue - the value to search forfromIndexInclusive - the index to start searching from, inclusive
-1 if not foundpublic int lastIndexOf(double value)
This implementation uses lastIndexof(double, int).
lastIndexOf in interface DoubleListvalue - the value to search for
-1 if not found
public int lastIndexOf(double 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 DoubleListvalue - the value to search forfromIndexInclusive - the index to start searching from, inclusive
-1 if not found
public double[] toDoubleArray(int fromIndexInclusive,
int toIndexExclusive)
toDoubleArray in interface DoubleListfromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusive
IndexOutOfBoundsException - if either index is invalid
public DoubleList 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<Double>subList in interface DoubleListfromIndexInclusive - 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<Double>clear in interface List<Double>clear in interface PrimitiveCollectable<Double>clear in class AbstractDoubleCollectionUnsupportedOperationException - if method not supported by this collectionpublic boolean add(double value)
This implementation uses add(int, double).
add in interface DoubleCollectionadd in class AbstractDoubleCollectionvalue - 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 collection
public boolean add(int index,
double value)
This implementation throws UnsupportedOperationException.
add in interface DoubleListindex - 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(double[] values)
This implementation uses addAll(int, double).
addAll in interface DoubleCollectionaddAll in class AbstractDoubleCollectionvalues - 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 collection
public boolean addAll(int index,
double[] values)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
addAll in interface DoubleListindex - 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 double removeDoubleAt(int index)
This implementation throws UnsupportedOperationException.
removeDoubleAt in interface DoubleListindex - the index to remove from
IndexOutOfBoundsException - if the index is invalid
UnsupportedOperationException - if not supported by this collectionpublic boolean removeDouble(double value)
This implementation uses get(int) and removeDoubleAt(int).
value - the value to remove
UnsupportedOperationException - if not supported by this collection
public boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
This implementation uses removeDoubleAt(int).
removeRange in interface PrimitiveList<Double>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 supported
public double set(int index,
double value)
This implementation throws UnsupportedOperationException.
set in interface DoubleListindex - 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 Double get(int index)
Double value at the specified index.
get in interface List<Double>index - the index to get from
IndexOutOfBoundsException - if the index is invalidpublic Double first()
Double value.
first in interface PrimitiveList<Double>public Double last()
Double value.
last in interface PrimitiveList<Double>size() - 1 or null if the size is zeropublic int indexOf(Object value)
Double value.
indexOf in interface List<Double>value - the value to search for
-1 if not found
NullPointerException - if the value if null
ClassCastException - if the object is not Double
public int indexOf(Object value,
int fromIndexInclusive)
Double 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 Doublepublic int lastIndexOf(Object value)
Double value.
lastIndexOf in interface List<Double>value - the value to search for
-1 if not found
NullPointerException - if the value if null
ClassCastException - if the object is not Double
public int lastIndexOf(Object value,
int fromIndexInclusive)
Double 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 Doublepublic boolean add(Double value)
Double value to this collection (optional operation).
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
add in interface Collection<Double>add in interface List<Double>add in class AbstractDoubleCollectionvalue - 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 collection
public void add(int index,
Double value)
Double 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<Double>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 Double
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collection
public boolean addAll(int index,
Collection<? extends Double> coll)
Double 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<Double>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 Double
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collectionpublic Double remove(int index)
removeDoubleAt(int)
This implementation uses removeDoubleAt(int).
remove in interface List<Double>remove in interface DoubleListindex - the index to remove from
IndexOutOfBoundsException - if the index is invalid
UnsupportedOperationException - if not supported by this collection
public Double set(int index,
Double value)
Double value at a specified index.
This implementation uses set(int, double).
set in interface List<Double>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<Double>equals in interface List<Double>equals in class Objectobj - the object to compare to
true if the lists are equalpublic int hashCode()
List.
hashCode in interface Collection<Double>hashCode in interface List<Double>hashCode in class Object
protected void arrayCopy(int fromIndex,
double[] dest,
int destIndex,
int size)
arrayCopy in class AbstractDoubleCollectionfromIndex - 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<Double>isModifiable in class AbstractDoubleCollectionprotected 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 invalid
protected 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 | |||||||||