public class ArrayByteList extends AbstractByteList implements Cloneable
ByteList for
primitive int elements.
This class implements List allowing
seamless integration with other APIs.
Add, Remove, Set and Clear are supported.
AbstractByteList.PListIterator| Constructor and Description |
|---|
ArrayByteList()
Constructor.
|
ArrayByteList(byte[] values)
Constructor that copies the specified values.
|
ArrayByteList(Collection<Byte> coll)
Constructor that copies the specified values.
|
ArrayByteList(int initialSize)
Constructor that defines an initial size for the internal storage array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int index,
byte value)
Adds a primitive value to this collection.
|
boolean |
addAll(int index,
byte[] values)
Adds an array of primitive values to this collection at a specified index.
|
protected void |
arrayCopy(int fromIndex,
byte[] 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(byte 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.
|
byte |
getByte(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.
|
byte |
removeByteAt(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.
|
byte |
set(int index,
byte value)
Sets the primitive value at a specified index.
|
int |
size()
Gets the current size of the collection.
|
add, add, add, addAll, addAll, checkIndex, checkIndexExists, checkRange, checkSetModifiable, equals, first, firstByte, get, hashCode, indexOf, indexOf, indexOf, indexOf, iterator, last, lastByte, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeByte, set, subList, toByteArrayaddAll, 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, toByteArray, toByteArray, 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, toByteArray, toByteArraycontainsAnyisEmptypublic ArrayByteList()
public ArrayByteList(int initialSize)
initialSize - the initial size of the internal array, negative treated as zeropublic ArrayByteList(byte[] values)
values - an array of values to copy, null treated as zero size arraypublic ArrayByteList(Collection<Byte> coll)
coll - a collection of values to copy, null treated as zero size collectionpublic int size()
size in interface Collection<Byte>size in interface List<Byte>size in interface PrimitiveCollectable<Byte>public byte getByte(int index)
getByte in interface ByteListindex - the index to get fromIndexOutOfBoundsException - if the index is invalidpublic boolean add(int index, byte value)
add in interface ByteListadd in class AbstractByteListindex - 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 byte removeByteAt(int index)
removeByteAt in interface ByteListremoveByteAt in class AbstractByteListindex - the index to remove fromIndexOutOfBoundsException - if the index is invalidpublic boolean removeRange(int fromIndexInclusive, int toIndexExclusive)
removeRange in interface PrimitiveList<Byte>removeRange in class AbstractByteListfromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusivetrue if the collection was modifiedpublic byte set(int index, byte value)
set in interface ByteListset in class AbstractByteListindex - 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<Byte>optimize in class AbstractPrimitiveCollectable<Byte>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<Byte>clear in interface List<Byte>clear in interface PrimitiveCollectable<Byte>clear in class AbstractByteListpublic boolean contains(byte value)
This implementation accesses the internal storage array directly.
contains in interface ByteCollectioncontains in class AbstractByteListvalue - the value to search fortrue if the value is foundpublic boolean addAll(int index, byte[] values)
addAll in interface ByteListaddAll in class AbstractByteListindex - 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 invalidprotected boolean isAddModifiable()
isAddModifiable in class AbstractByteCollectiontrueprotected boolean isRemoveModifiable()
isRemoveModifiable in class AbstractByteCollectiontrueprotected boolean isSetModifiable()
isSetModifiable in class AbstractByteListtruepublic boolean isModifiable()
isModifiable in interface PrimitiveCollectable<Byte>isModifiable in class AbstractByteListtruepublic Object clone()
clone in interface PrimitiveCollectable<Byte>clone in class AbstractPrimitiveCollectable<Byte>protected void arrayCopy(int fromIndex, byte[] dest, int destIndex, int size)
arrayCopy in class AbstractByteListfromIndex - 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.