public class ArrayCharList extends AbstractCharList implements Cloneable
CharList for
primitive int elements.
This class implements List allowing
seamless integration with other APIs.
Add, Remove, Set and Clear are supported.
AbstractCharList.PListIterator| Constructor and Description |
|---|
ArrayCharList()
Constructor.
|
ArrayCharList(char[] values)
Constructor that copies the specified values.
|
ArrayCharList(Collection<Character> coll)
Constructor that copies the specified values.
|
ArrayCharList(int initialSize)
Constructor that defines an initial size for the internal storage array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int index,
char value)
Adds a primitive value to this collection.
|
boolean |
addAll(int index,
char[] values)
Adds an array of primitive values to this collection at a specified index.
|
protected void |
arrayCopy(int fromIndex,
char[] 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(char 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.
|
char |
getChar(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.
|
char |
removeCharAt(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.
|
char |
set(int index,
char value)
Sets the primitive value at a specified index.
|
int |
size()
Gets the current size of the collection.
|
String |
toStringContents()
Gets the contents of the list as a String.
|
add, add, add, addAll, addAll, checkIndex, checkIndexExists, checkRange, checkSetModifiable, equals, first, firstChar, get, hashCode, indexOf, indexOf, indexOf, indexOf, iterator, last, lastChar, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeChar, set, subList, toCharArrayaddAll, 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, toCharArray, toCharArray, toObject, toPrimitive, toPrimitiveArray, toStringisEmptyfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayaddAll, addAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toCharArray, toCharArraycontainsAnyisEmptypublic ArrayCharList()
public ArrayCharList(int initialSize)
initialSize - the initial size of the internal array, negative treated as zeropublic ArrayCharList(char[] values)
values - an array of values to copy, null treated as zero size arraypublic ArrayCharList(Collection<Character> coll)
coll - a collection of values to copy, null treated as zero size collectionpublic int size()
size in interface Collection<Character>size in interface List<Character>size in interface PrimitiveCollectable<Character>public char getChar(int index)
getChar in interface CharListindex - the index to get fromIndexOutOfBoundsException - if the index is invalidpublic boolean add(int index, char value)
add in interface CharListadd in class AbstractCharListindex - the index to insert atvalue - the value to add to this collectiontrue if this collection was modified by this method callIndexOutOfBoundsException - if the index is invalidpublic char removeCharAt(int index)
removeCharAt in interface CharListremoveCharAt in class AbstractCharListindex - the index to remove fromIndexOutOfBoundsException - if the index is invalidpublic boolean removeRange(int fromIndexInclusive, int toIndexExclusive)
removeRange in interface PrimitiveList<Character>removeRange in class AbstractCharListfromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusivetrue if the collection was modifiedpublic char set(int index, char value)
set in interface CharListset in class AbstractCharListindex - the index to setvalue - the value to storeIndexOutOfBoundsException - 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<Character>optimize in class AbstractPrimitiveCollectable<Character>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<Character>clear in interface List<Character>clear in interface PrimitiveCollectable<Character>clear in class AbstractCharListpublic boolean contains(char value)
This implementation accesses the internal storage array directly.
contains in interface CharCollectioncontains in class AbstractCharListvalue - the value to search fortrue if the value is foundpublic boolean addAll(int index, char[] values)
addAll in interface CharListaddAll in class AbstractCharListindex - the index to add atvalues - the values to add to this collectiontrue if this collection was modified by this method callIndexOutOfBoundsException - if the index is invalidpublic String toStringContents()
toStringContents in interface CharListtoStringContents in class AbstractCharListprotected boolean isAddModifiable()
isAddModifiable in class AbstractCharCollectiontrueprotected boolean isRemoveModifiable()
isRemoveModifiable in class AbstractCharCollectiontrueprotected boolean isSetModifiable()
isSetModifiable in class AbstractCharListtruepublic boolean isModifiable()
isModifiable in interface PrimitiveCollectable<Character>isModifiable in class AbstractCharListtruepublic Object clone()
clone in interface PrimitiveCollectable<Character>clone in class AbstractPrimitiveCollectable<Character>protected void arrayCopy(int fromIndex, char[] dest, int destIndex, int size)
arrayCopy in class AbstractCharListfromIndex - 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 toCopyright © 2005-2012 Joda.org. All Rights Reserved.