public abstract class AbstractBooleanList extends AbstractBooleanCollection implements BooleanList
boolean 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, boolean),
removeIndex(int) and set(int, boolean) must also be implemented.
Subclasses may override other methods to increase efficiency.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractBooleanList.PListIterator
List iterator.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBooleanList()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(boolean value)
Adds a primitive value to this collection (optional operation).
|
boolean |
add(java.lang.Boolean value)
Adds the
Boolean value to this collection (optional operation). |
boolean |
add(int index,
boolean value)
Adds a primitive value to this list at an index (optional operation).
|
void |
add(int index,
java.lang.Boolean value)
Adds the
Boolean value to this list at an index (optional operation). |
boolean |
addAll(boolean[] values)
Adds an array of primitive values to this list at an index (optional operation).
|
boolean |
addAll(int index,
boolean[] values)
Adds an array of primitive values to this list at an index (optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Boolean> coll)
Adds an array of
Boolean values to this list at an index (optional operation). |
protected void |
arrayCopy(int fromIndex,
boolean[] 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(boolean value)
Checks whether this collection contains a specified primitive value.
|
boolean |
equals(java.lang.Object obj)
Compares this list to another as per the contract of
List. |
java.lang.Boolean |
first()
Gets the first
Boolean value. |
boolean |
firstBoolean()
Gets the first primitive value.
|
java.lang.Boolean |
get(int index)
Gets the
Boolean value at the specified index. |
int |
hashCode()
Gets the hashCode of this list as per the contract of
List. |
int |
indexOf(boolean value)
Gets the first index of the specified primitive value.
|
int |
indexOf(boolean value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index.
|
int |
indexOf(java.lang.Object value)
Gets the first index of the specified
Boolean value. |
int |
indexOf(java.lang.Object value,
int fromIndexInclusive)
Gets the first index of the specified
Boolean value from an index. |
boolean |
isModifiable()
Is the collection modifiable in any way.
|
protected boolean |
isSetModifiable()
Are the set methods supported.
|
BooleanListIterator |
iterator()
Gets an iterator over this list.
|
java.lang.Boolean |
last()
Gets the last
Boolean value. |
boolean |
lastBoolean()
Gets the last primitive value.
|
int |
lastIndexOf(boolean value)
Gets the last index of the specified primitive value.
|
int |
lastIndexOf(boolean value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index.
|
int |
lastIndexOf(java.lang.Object value)
Gets the last index of the specified
Boolean value. |
int |
lastIndexOf(java.lang.Object value,
int fromIndexInclusive)
Gets the first index of the specified
Boolean value from an index. |
BooleanListIterator |
listIterator()
Gets a list iterator over this list.
|
BooleanListIterator |
listIterator(int index)
Gets a list iterator over this list from a start index.
|
java.lang.Boolean |
remove(int index)
Deprecated.
This method should only be used when working with List and
not when working with BooleanList - use
removeBooleanAt(int) |
boolean |
removeBoolean(boolean value)
Removes the first occurrence of a primitive value from the list (optional operation).
|
boolean |
removeBooleanAt(int index)
Removes a primitive value by index from the list (optional operation).
|
boolean |
removeRange(int fromIndexInclusive,
int toIndexExclusive)
Removes a range of values from the list (optional operation).
|
boolean |
set(int index,
boolean value)
Sets the primitive value at a specified index.
|
java.lang.Boolean |
set(int index,
java.lang.Boolean value)
Sets the
Boolean value at a specified index. |
BooleanList |
subList(int fromIndexInclusive,
int toIndexExclusive)
Deprecated.
Not implemented yet.
|
boolean[] |
toBooleanArray(int fromIndexInclusive,
int toIndexExclusive)
Gets a range of elements as an array.
|
addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, isAddModifiable, isRemoveModifiable, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toArray, toArray, toBooleanArray, toBooleanArray, toObject, toPrimitive, toPrimitiveArray, toStringclone, isEmpty, optimizefinalize, getClass, notify, notifyAll, wait, wait, waitgetBooleanaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArrayaddAll, containsAll, containsAll, containsAny, containsAny, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, toBooleanArray, toBooleanArraycontainsAnyclone, isEmpty, optimize, sizepublic BooleanListIterator iterator()
iterator in interface java.lang.Iterable<java.lang.Boolean>iterator in interface java.util.Collection<java.lang.Boolean>iterator in interface java.util.List<java.lang.Boolean>iterator in interface BooleanCollectioniterator in interface BooleanIterableiterator in interface BooleanListpublic BooleanListIterator listIterator()
This implementation uses booleanListIterator(int).
listIterator in interface java.util.List<java.lang.Boolean>listIterator in interface BooleanListpublic BooleanListIterator listIterator(int index)
listIterator in interface java.util.List<java.lang.Boolean>listIterator in interface BooleanListindex - the index to start fromjava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean firstBoolean()
firstBoolean in interface BooleanListjava.lang.IndexOutOfBoundsException - if the size is zeropublic boolean lastBoolean()
lastBoolean in interface BooleanListsize() - 1java.lang.IndexOutOfBoundsException - if the size is zeropublic boolean contains(boolean value)
This implementation uses getBoolean(int).
contains in interface BooleanCollectioncontains in class AbstractBooleanCollectionvalue - the value to search fortrue if the value is foundpublic int indexOf(boolean value)
This implementation uses indexof(boolean, int).
indexOf in interface BooleanListvalue - the value to search for-1 if not foundpublic int indexOf(boolean 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 BooleanListvalue - the value to search forfromIndexInclusive - the index to start searching from, inclusive-1 if not foundpublic int lastIndexOf(boolean value)
This implementation uses lastIndexof(boolean, int).
lastIndexOf in interface BooleanListvalue - the value to search for-1 if not foundpublic int lastIndexOf(boolean 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 BooleanListvalue - the value to search forfromIndexInclusive - the index to start searching from, inclusive-1 if not foundpublic boolean[] toBooleanArray(int fromIndexInclusive,
int toIndexExclusive)
toBooleanArray in interface BooleanListfromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusivejava.lang.IndexOutOfBoundsException - if either index is invalid@Deprecated public BooleanList 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 java.util.List<java.lang.Boolean>subList in interface BooleanListfromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusivejava.lang.UnsupportedOperationException - alwayspublic void clear()
This implementation uses removeRange(int, int).
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 AbstractBooleanCollectionjava.lang.UnsupportedOperationException - if method not supported by this collectionpublic boolean add(boolean value)
This implementation uses add(int, boolean).
add in interface BooleanCollectionadd in class AbstractBooleanCollectionvalue - the value to add to this collectiontrue if this collection was modified by this method calljava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean add(int index,
boolean value)
This implementation throws UnsupportedOperationException.
add in interface BooleanListindex - the index to add atvalue - the value to add to this collectiontrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean addAll(boolean[] values)
This implementation uses addAll(int, boolean).
addAll in interface BooleanCollectionaddAll in class AbstractBooleanCollectionvalues - the values to add to this collection, null treated as empty arraytrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean addAll(int index,
boolean[] values)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
addAll in interface BooleanListindex - the index to add atvalues - the values to add to this collection, null treated as empty arraytrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean removeBooleanAt(int index)
This implementation throws UnsupportedOperationException.
removeBooleanAt in interface BooleanListindex - the index to remove fromjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean removeBoolean(boolean value)
This implementation uses get(int) and removeBooleanAt(int).
value - the value to removejava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean removeRange(int fromIndexInclusive,
int toIndexExclusive)
This implementation uses removeBooleanAt(int).
removeRange in interface PrimitiveList<java.lang.Boolean>fromIndexInclusive - the start of the range to remove, inclusivetoIndexExclusive - the end of the range to remove, exclusivetrue if the collection was modifiedjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.UnsupportedOperationException - if remove is not supportedpublic boolean set(int index,
boolean value)
This implementation throws UnsupportedOperationException.
set in interface BooleanListindex - the index to setvalue - the value to storejava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic java.lang.Boolean get(int index)
Boolean value at the specified index.get in interface java.util.List<java.lang.Boolean>index - the index to get fromjava.lang.IndexOutOfBoundsException - if the index is invalidpublic java.lang.Boolean first()
Boolean value.first in interface PrimitiveList<java.lang.Boolean>public java.lang.Boolean last()
Boolean value.last in interface PrimitiveList<java.lang.Boolean>size() - 1 or null if the size is zeropublic int indexOf(java.lang.Object value)
Boolean value.indexOf in interface java.util.List<java.lang.Boolean>value - the value to search for-1 if not foundjava.lang.NullPointerException - if the value if nulljava.lang.ClassCastException - if the object is not Booleanpublic int indexOf(java.lang.Object value,
int fromIndexInclusive)
Boolean 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 foundjava.lang.NullPointerException - if the value if nulljava.lang.ClassCastException - if the object is not Booleanpublic int lastIndexOf(java.lang.Object value)
Boolean value.lastIndexOf in interface java.util.List<java.lang.Boolean>value - the value to search for-1 if not foundjava.lang.NullPointerException - if the value if nulljava.lang.ClassCastException - if the object is not Booleanpublic int lastIndexOf(java.lang.Object value,
int fromIndexInclusive)
Boolean 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 foundjava.lang.NullPointerException - if the value if nulljava.lang.ClassCastException - if the object is not Booleanpublic boolean add(java.lang.Boolean value)
Boolean value to this collection (optional operation).
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
add in interface java.util.Collection<java.lang.Boolean>add in interface java.util.List<java.lang.Boolean>add in class AbstractBooleanCollectionvalue - the value to add to this collectiontrue if this collection was modified by this method calljava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic void add(int index,
java.lang.Boolean value)
Boolean 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 java.util.List<java.lang.Boolean>index - the index to add atvalue - the value to add to this collectionjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.ClassCastException - if the object is not Booleanjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean addAll(int index,
java.util.Collection<? extends java.lang.Boolean> coll)
Boolean 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 java.util.List<java.lang.Boolean>index - the index to add atcoll - the values to add to this collectiontrue if this list was modified by this method calljava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.ClassCastException - if any object is not Booleanjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collection@Deprecated public java.lang.Boolean remove(int index)
removeBooleanAt(int)
This implementation uses removeBooleanAt(int).
remove in interface java.util.List<java.lang.Boolean>remove in interface BooleanListindex - the index to remove fromjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.UnsupportedOperationException - if not supported by this collectionpublic java.lang.Boolean set(int index,
java.lang.Boolean value)
Boolean value at a specified index.
This implementation uses set(int, boolean).
set in interface java.util.List<java.lang.Boolean>index - the index to setvalue - the value to storejava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.IllegalArgumentException - if value is rejected by this collectionjava.lang.UnsupportedOperationException - if not supported by this collectionpublic boolean equals(java.lang.Object obj)
List.equals in interface java.util.Collection<java.lang.Boolean>equals in interface java.util.List<java.lang.Boolean>equals in class java.lang.Objectobj - the object to compare totrue if the lists are equalpublic int hashCode()
List.hashCode in interface java.util.Collection<java.lang.Boolean>hashCode in interface java.util.List<java.lang.Boolean>hashCode in class java.lang.Objectprotected void arrayCopy(int fromIndex,
boolean[] dest,
int destIndex,
int size)
arrayCopy in class AbstractBooleanCollectionfromIndex - 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<java.lang.Boolean>isModifiable in class AbstractBooleanCollectionprotected void checkSetModifiable()
protected void checkIndexExists(int index)
index - the index to checkjava.lang.IndexOutOfBoundsException - if either index is invalidprotected void checkIndex(int index)
index - the index to checkjava.lang.IndexOutOfBoundsException - if either index is invalidprotected void checkRange(int fromIndexInclusive,
int toIndexExclusive)
fromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusivejava.lang.IndexOutOfBoundsException - if either index is invalidCopyright © 2005–2018 Joda.org. All rights reserved.