|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.joda.primitives.collection.impl.AbstractPrimitiveCollectable<Short>
org.joda.primitives.collection.impl.AbstractShortCollection
org.joda.primitives.list.impl.AbstractShortList
public abstract class AbstractShortList
Abstract base class for lists of primitive short 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, short),
removeIndex(int) and set(int, short) must also be implemented.
Subclasses may override other methods to increase efficiency.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractShortList.PListIterator
List iterator. |
| Constructor Summary | |
|---|---|
protected |
AbstractShortList()
Constructor. |
| Method Summary | |
|---|---|
boolean |
add(int index,
short value)
Adds a primitive value to this list at an index (optional operation). |
void |
add(int index,
Short value)
Adds the Short value to this list at an index (optional operation). |
boolean |
add(short value)
Adds a primitive value to this collection (optional operation). |
boolean |
add(Short value)
Adds the Short value to this collection (optional operation). |
boolean |
addAll(int index,
Collection<? extends Short> coll)
Adds an array of Short values to this list at an index (optional operation). |
boolean |
addAll(int index,
short[] values)
Adds an array of primitive values to this list at an index (optional operation). |
boolean |
addAll(short[] values)
Adds an array of primitive values to this list at an index (optional operation). |
protected void |
arrayCopy(int fromIndex,
short[] 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(short 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. |
Short |
first()
Gets the first Short value. |
short |
firstShort()
Gets the first primitive value. |
Short |
get(int index)
Gets the Short value at the specified index. |
int |
hashCode()
Gets the hashCode of this list as per the contract of List. |
int |
indexOf(Object value)
Gets the first index of the specified Short value. |
int |
indexOf(Object value,
int fromIndexInclusive)
Gets the first index of the specified Short value from an index. |
int |
indexOf(short value)
Gets the first index of the specified primitive value. |
int |
indexOf(short value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
boolean |
isModifiable()
Is the collection modifiable in any way. |
protected boolean |
isSetModifiable()
Are the set methods supported. |
ShortListIterator |
iterator()
Gets an iterator over this list. |
Short |
last()
Gets the last Short value. |
int |
lastIndexOf(Object value)
Gets the last index of the specified Short value. |
int |
lastIndexOf(Object value,
int fromIndexInclusive)
Gets the first index of the specified Short value from an index. |
int |
lastIndexOf(short value)
Gets the last index of the specified primitive value. |
int |
lastIndexOf(short value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
short |
lastShort()
Gets the last primitive value. |
ShortListIterator |
listIterator()
Gets a list iterator over this list. |
ShortListIterator |
listIterator(int index)
Gets a list iterator over this list from a start index. |
Short |
remove(int index)
Deprecated. This method should only be used when working with List and not when working with ShortList - use removeShortAt(int) |
boolean |
removeRange(int fromIndexInclusive,
int toIndexExclusive)
Removes a range of values from the list (optional operation). |
boolean |
removeShort(short value)
Removes the first occurrence of a primitive value from the list (optional operation). |
short |
removeShortAt(int index)
Removes a primitive value by index from the list (optional operation). |
short |
set(int index,
short value)
Sets the primitive value at a specified index. |
Short |
set(int index,
Short value)
Sets the Short value at a specified index. |
ShortList |
subList(int fromIndexInclusive,
int toIndexExclusive)
Gets a range view of part of this list. |
short[] |
toShortArray(int fromIndexInclusive,
int toIndexExclusive)
Gets a range of elements as an array. |
| Methods inherited from class org.joda.primitives.collection.impl.AbstractShortCollection |
|---|
addAll, addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, isAddModifiable, isRemoveModifiable, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, retainAll, toArray, toArray, toObject, toPrimitive, toPrimitiveArray, toShortArray, toShortArray, 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.ShortList |
|---|
getShort |
| 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.ShortCollection |
|---|
addAll, addAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toShortArray, toShortArray |
| 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 AbstractShortList()
| Method Detail |
|---|
public ShortListIterator iterator()
iterator in interface Iterable<Short>iterator in interface Collection<Short>iterator in interface List<Short>iterator in interface ShortCollectioniterator in interface ShortIterableiterator in interface ShortListpublic ShortListIterator listIterator()
This implementation uses shortListIterator(int).
listIterator in interface List<Short>listIterator in interface ShortListpublic ShortListIterator listIterator(int index)
listIterator in interface List<Short>listIterator in interface ShortListindex - the index to start from
IndexOutOfBoundsException - if the index is invalidpublic short firstShort()
firstShort in interface ShortListIndexOutOfBoundsException - if the size is zeropublic short lastShort()
lastShort in interface ShortListsize() - 1
IndexOutOfBoundsException - if the size is zeropublic boolean contains(short value)
This implementation uses getShort(int).
contains in interface ShortCollectioncontains in class AbstractShortCollectionvalue - the value to search for
true if the value is foundpublic int indexOf(short value)
This implementation uses indexof(short, int).
indexOf in interface ShortListvalue - the value to search for
-1 if not found
public int indexOf(short 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 ShortListvalue - the value to search forfromIndexInclusive - the index to start searching from, inclusive
-1 if not foundpublic int lastIndexOf(short value)
This implementation uses lastIndexof(short, int).
lastIndexOf in interface ShortListvalue - the value to search for
-1 if not found
public int lastIndexOf(short 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 ShortListvalue - the value to search forfromIndexInclusive - the index to start searching from, inclusive
-1 if not found
public short[] toShortArray(int fromIndexInclusive,
int toIndexExclusive)
toShortArray in interface ShortListfromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusive
IndexOutOfBoundsException - if either index is invalid
public ShortList 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<Short>subList in interface ShortListfromIndexInclusive - 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<Short>clear in interface List<Short>clear in interface PrimitiveCollectable<Short>clear in class AbstractShortCollectionUnsupportedOperationException - if method not supported by this collectionpublic boolean add(short value)
This implementation uses add(int, short).
add in interface ShortCollectionadd in class AbstractShortCollectionvalue - 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,
short value)
This implementation throws UnsupportedOperationException.
add in interface ShortListindex - 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(short[] values)
This implementation uses addAll(int, short).
addAll in interface ShortCollectionaddAll in class AbstractShortCollectionvalues - 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,
short[] values)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
addAll in interface ShortListindex - 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 short removeShortAt(int index)
This implementation throws UnsupportedOperationException.
removeShortAt in interface ShortListindex - the index to remove from
IndexOutOfBoundsException - if the index is invalid
UnsupportedOperationException - if not supported by this collectionpublic boolean removeShort(short value)
This implementation uses get(int) and removeShortAt(int).
value - the value to remove
UnsupportedOperationException - if not supported by this collection
public boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
This implementation uses removeShortAt(int).
removeRange in interface PrimitiveList<Short>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 short set(int index,
short value)
This implementation throws UnsupportedOperationException.
set in interface ShortListindex - 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 Short get(int index)
Short value at the specified index.
get in interface List<Short>index - the index to get from
IndexOutOfBoundsException - if the index is invalidpublic Short first()
Short value.
first in interface PrimitiveList<Short>public Short last()
Short value.
last in interface PrimitiveList<Short>size() - 1 or null if the size is zeropublic int indexOf(Object value)
Short value.
indexOf in interface List<Short>value - the value to search for
-1 if not found
NullPointerException - if the value if null
ClassCastException - if the object is not Short
public int indexOf(Object value,
int fromIndexInclusive)
Short 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 Shortpublic int lastIndexOf(Object value)
Short value.
lastIndexOf in interface List<Short>value - the value to search for
-1 if not found
NullPointerException - if the value if null
ClassCastException - if the object is not Short
public int lastIndexOf(Object value,
int fromIndexInclusive)
Short 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 Shortpublic boolean add(Short value)
Short value to this collection (optional operation).
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
add in interface Collection<Short>add in interface List<Short>add in class AbstractShortCollectionvalue - 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,
Short value)
Short 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<Short>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 Short
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collection
public boolean addAll(int index,
Collection<? extends Short> coll)
Short 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<Short>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 Short
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collectionpublic Short remove(int index)
removeShortAt(int)
This implementation uses removeShortAt(int).
remove in interface List<Short>remove in interface ShortListindex - the index to remove from
IndexOutOfBoundsException - if the index is invalid
UnsupportedOperationException - if not supported by this collection
public Short set(int index,
Short value)
Short value at a specified index.
This implementation uses set(int, short).
set in interface List<Short>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<Short>equals in interface List<Short>equals in class Objectobj - the object to compare to
true if the lists are equalpublic int hashCode()
List.
hashCode in interface Collection<Short>hashCode in interface List<Short>hashCode in class Object
protected void arrayCopy(int fromIndex,
short[] dest,
int destIndex,
int size)
arrayCopy in class AbstractShortCollectionfromIndex - 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<Short>isModifiable in class AbstractShortCollectionprotected 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 | |||||||||