public class ArrayBooleanList extends AbstractBooleanList implements java.lang.Cloneable
BooleanList for
primitive int elements.
This class implements List allowing
seamless integration with other APIs.
Add, Remove, Set and Clear are supported.
AbstractBooleanList.PListIterator| Constructor and Description |
|---|
ArrayBooleanList()
Constructor.
|
ArrayBooleanList(boolean[] values)
Constructor that copies the specified values.
|
ArrayBooleanList(java.util.Collection<java.lang.Boolean> coll)
Constructor that copies the specified values.
|
ArrayBooleanList(int initialSize)
Constructor that defines an initial size for the internal storage array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int index,
boolean value)
Adds a primitive value to this collection.
|
boolean |
addAll(int index,
boolean[] values)
Adds an array of primitive values to this collection at a specified index.
|
protected void |
arrayCopy(int fromIndex,
boolean[] dest,
int destIndex,
int size)
Copies data from this collection into the specified array.
|
void |
clear()
Clears the collection/map of all elements.
|
java.lang.Object |
clone()
Clone implementation that calls Object clone().
|
boolean |
contains(boolean 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.
|
boolean |
getBoolean(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 |
removeBooleanAt(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.
|
boolean |
set(int index,
boolean 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, firstBoolean, get, hashCode, indexOf, indexOf, indexOf, indexOf, iterator, last, lastBoolean, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeBoolean, set, subList, toBooleanArrayaddAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toArray, toArray, toBooleanArray, toBooleanArray, toObject, toPrimitive, toPrimitiveArray, toStringisEmptyfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayaddAll, containsAll, containsAll, containsAny, containsAny, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, toBooleanArray, toBooleanArraycontainsAnyisEmptypublic ArrayBooleanList()
public ArrayBooleanList(int initialSize)
initialSize - the initial size of the internal array, negative treated as zeropublic ArrayBooleanList(boolean[] values)
values - an array of values to copy, null treated as zero size arraypublic ArrayBooleanList(java.util.Collection<java.lang.Boolean> coll)
coll - a collection of values to copy, null treated as zero size collectionpublic int size()
size in interface java.util.Collection<java.lang.Boolean>size in interface java.util.List<java.lang.Boolean>size in interface PrimitiveCollectable<java.lang.Boolean>public boolean getBoolean(int index)
getBoolean in interface BooleanListindex - the index to get fromjava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean add(int index,
boolean value)
add in interface BooleanListadd in class AbstractBooleanListindex - the index to insert atvalue - the value to add to this collectiontrue if this collection was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean removeBooleanAt(int index)
removeBooleanAt in interface BooleanListremoveBooleanAt in class AbstractBooleanListindex - the index to remove fromjava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
removeRange in interface PrimitiveList<java.lang.Boolean>removeRange in class AbstractBooleanListfromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusivetrue if the collection was modifiedpublic boolean set(int index,
boolean value)
set in interface BooleanListset in class AbstractBooleanListindex - the index to setvalue - the value to storejava.lang.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<java.lang.Boolean>optimize in class AbstractPrimitiveCollectable<java.lang.Boolean>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 java.util.Collection<java.lang.Boolean>clear in interface java.util.List<java.lang.Boolean>clear in interface PrimitiveCollectable<java.lang.Boolean>clear in class AbstractBooleanListpublic boolean contains(boolean value)
This implementation accesses the internal storage array directly.
contains in interface BooleanCollectioncontains in class AbstractBooleanListvalue - the value to search fortrue if the value is foundpublic boolean addAll(int index,
boolean[] values)
addAll in interface BooleanListaddAll in class AbstractBooleanListindex - the index to add atvalues - the values to add to this collectiontrue if this collection was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidprotected boolean isAddModifiable()
isAddModifiable in class AbstractBooleanCollectiontrueprotected boolean isRemoveModifiable()
isRemoveModifiable in class AbstractBooleanCollectiontrueprotected boolean isSetModifiable()
isSetModifiable in class AbstractBooleanListtruepublic boolean isModifiable()
isModifiable in interface PrimitiveCollectable<java.lang.Boolean>isModifiable in class AbstractBooleanListtruepublic java.lang.Object clone()
clone in interface PrimitiveCollectable<java.lang.Boolean>clone in class AbstractPrimitiveCollectable<java.lang.Boolean>protected void arrayCopy(int fromIndex,
boolean[] dest,
int destIndex,
int size)
arrayCopy in class AbstractBooleanListfromIndex - 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–2018 Joda.org. All rights reserved.