|
||||||||||
| 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
org.joda.primitives.list.impl.ArrayShortList
public class ArrayShortList
Array based implementation of ShortList 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.AbstractShortList |
|---|
AbstractShortList.PListIterator |
| Constructor Summary | |
|---|---|
ArrayShortList()
Constructor. |
|
ArrayShortList(Collection<Short> coll)
Constructor that copies the specified values. |
|
ArrayShortList(int initialSize)
Constructor that defines an initial size for the internal storage array. |
|
ArrayShortList(short[] values)
Constructor that copies the specified values. |
|
| Method Summary | |
|---|---|
boolean |
add(int index,
short value)
Adds a primitive value to this collection. |
boolean |
addAll(int index,
short[] values)
Adds an array of primitive values to this collection at a specified index. |
protected void |
arrayCopy(int fromIndex,
short[] 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(short 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. |
short |
getShort(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. |
boolean |
removeRange(int fromIndexInclusive,
int toIndexExclusive)
Removes a range of values from the list. |
short |
removeShortAt(int index)
Removes a primitive value by index from the list. |
short |
set(int index,
short 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.AbstractShortList |
|---|
add, add, add, addAll, addAll, checkIndex, checkIndexExists, checkRange, checkSetModifiable, equals, first, firstShort, get, hashCode, indexOf, indexOf, indexOf, indexOf, iterator, last, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastShort, listIterator, listIterator, remove, removeShort, set, subList, toShortArray |
| Methods inherited from class org.joda.primitives.collection.impl.AbstractShortCollection |
|---|
addAll, addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, 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 |
|---|
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.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 |
|---|
isEmpty |
| Constructor Detail |
|---|
public ArrayShortList()
public ArrayShortList(int initialSize)
initialSize - the initial size of the internal array, negative treated as zeropublic ArrayShortList(short[] values)
values - an array of values to copy, null treated as zero size arraypublic ArrayShortList(Collection<Short> coll)
coll - a collection of values to copy, null treated as zero size collection| Method Detail |
|---|
public int size()
size in interface Collection<Short>size in interface List<Short>size in interface PrimitiveCollectable<Short>public short getShort(int index)
getShort in interface ShortListindex - the index to get from
IndexOutOfBoundsException - if the index is invalid
public boolean add(int index,
short value)
add in interface ShortListadd in class AbstractShortListindex - 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 short removeShortAt(int index)
removeShortAt in interface ShortListremoveShortAt in class AbstractShortListindex - the index to remove from
IndexOutOfBoundsException - if the index is invalid
public boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
removeRange in interface PrimitiveList<Short>removeRange in class AbstractShortListfromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusive
true if the collection was modified
public short set(int index,
short value)
set in interface ShortListset in class AbstractShortListindex - 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<Short>optimize in class AbstractPrimitiveCollectable<Short>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<Short>clear in interface List<Short>clear in interface PrimitiveCollectable<Short>clear in class AbstractShortListpublic boolean contains(short value)
This implementation accesses the internal storage array directly.
contains in interface ShortCollectioncontains in class AbstractShortListvalue - the value to search for
true if the value is found
public boolean addAll(int index,
short[] values)
addAll in interface ShortListaddAll in class AbstractShortListindex - 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 AbstractShortCollectiontrueprotected boolean isRemoveModifiable()
isRemoveModifiable in class AbstractShortCollectiontrueprotected boolean isSetModifiable()
isSetModifiable in class AbstractShortListtruepublic boolean isModifiable()
isModifiable in interface PrimitiveCollectable<Short>isModifiable in class AbstractShortListtruepublic Object clone()
clone in interface PrimitiveCollectable<Short>clone in class AbstractPrimitiveCollectable<Short>
protected void arrayCopy(int fromIndex,
short[] dest,
int destIndex,
int size)
arrayCopy in class AbstractShortListfromIndex - 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 | |||||||||