public static class BooleanLists.Singleton extends AbstractBooleanList implements java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific list.
AbstractBooleanList.BooleanSubList
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(BooleanCollection c)
Adds all elements of the given type-specific collection to this collection.
|
boolean |
addAll(java.util.Collection<? extends java.lang.Boolean> c)
Delegates to a more generic method.
|
boolean |
addAll(int i,
BooleanCollection c)
Delegates to a more generic method.
|
boolean |
addAll(int i,
java.util.Collection<? extends java.lang.Boolean> c) |
void |
clear() |
java.lang.Object |
clone() |
boolean |
contains(boolean k) |
boolean |
getBoolean(int i) |
BooleanListIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
BooleanListIterator |
listIterator()
Returns a type-specific list iterator on the list.
|
BooleanListIterator |
listIterator(int i)
Returns a type-specific list iterator on the list starting at a given index.
|
boolean |
rem(boolean k)
Note that this method should be called
remove() , but the clash
with the similarly named index-based method in the List interface
forces us to use a distinguished name. |
boolean |
removeAll(java.util.Collection<?> c)
Remove from this collection all elements in the given collection.
|
boolean |
removeBoolean(int i) |
boolean |
retainAll(java.util.Collection<?> c)
Retains in this collection only elements from the given collection.
|
int |
size() |
void |
size(int size)
Sets the size of this list.
|
BooleanList |
subList(int from,
int to)
Returns a type-specific view of the portion of this list from the index
from , inclusive, to the index to , exclusive. |
boolean[] |
toBooleanArray()
Returns a primitive type array containing the items of this collection.
|
add, add, add, addAll, addAll, addElements, addElements, booleanListIterator, booleanListIterator, booleanSubList, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, peek, peekBoolean, pop, popBoolean, push, push, remove, remove, removeElements, set, set, top, topBoolean, toString
add, booleanIterator, contains, containsAll, containsAll, isEmpty, rem, removeAll, retainAll, toArray, toArray, toArray, toBooleanArray
add, contains, containsAll, isEmpty, replaceAll, sort, spliterator, toArray, toArray
booleanIterator, containsAll, removeAll, retainAll, toArray, toArray, toBooleanArray
public boolean getBoolean(int i)
getBoolean
in interface BooleanList
List.get(int)
public boolean removeBoolean(int i)
removeBoolean
in interface BooleanList
removeBoolean
in class AbstractBooleanList
List.remove(int)
public boolean contains(boolean k)
contains
in interface BooleanCollection
contains
in class AbstractBooleanList
Collection.contains(Object)
public boolean addAll(java.util.Collection<? extends java.lang.Boolean> c)
AbstractBooleanList
addAll
in interface java.util.Collection<java.lang.Boolean>
addAll
in interface java.util.List<java.lang.Boolean>
addAll
in class AbstractBooleanList
c
- a collection.true
if this collection changed as a result of the call.public boolean addAll(int i, java.util.Collection<? extends java.lang.Boolean> c)
addAll
in interface java.util.List<java.lang.Boolean>
addAll
in class AbstractBooleanList
public boolean removeAll(java.util.Collection<?> c)
AbstractBooleanCollection
removeAll
in interface java.util.Collection<java.lang.Boolean>
removeAll
in interface java.util.List<java.lang.Boolean>
removeAll
in class AbstractBooleanCollection
c
- a collection.true
if this collection changed as a result of the call.public boolean retainAll(java.util.Collection<?> c)
AbstractBooleanCollection
retainAll
in interface java.util.Collection<java.lang.Boolean>
retainAll
in interface java.util.List<java.lang.Boolean>
retainAll
in class AbstractBooleanCollection
c
- a collection.true
if this collection changed as a result of the call.public boolean[] toBooleanArray()
BooleanCollection
toBooleanArray
in interface BooleanCollection
toBooleanArray
in class AbstractBooleanCollection
Collection.toArray()
public BooleanListIterator listIterator()
BooleanList
listIterator
in interface BooleanList
listIterator
in interface java.util.List<java.lang.Boolean>
listIterator
in class AbstractBooleanList
List.listIterator()
public BooleanListIterator iterator()
BooleanCollection
Note that this specification strengthens the one given in
Iterable.iterator()
, which was already
strengthened in the corresponding type-specific class,
but was weakened by the fact that this interface extends Collection
.
iterator
in interface BooleanCollection
iterator
in interface BooleanIterable
iterator
in interface BooleanList
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 class AbstractBooleanList
public BooleanListIterator listIterator(int i)
BooleanList
listIterator
in interface BooleanList
listIterator
in interface java.util.List<java.lang.Boolean>
listIterator
in class AbstractBooleanList
List.listIterator(int)
public BooleanList subList(int from, int to)
BooleanList
from
, inclusive, to the index to
, exclusive.
Note that this specification strengthens the one given in List.subList(int,int)
.
subList
in interface BooleanList
subList
in interface java.util.List<java.lang.Boolean>
subList
in class AbstractBooleanList
List.subList(int,int)
public int size()
size
in interface java.util.Collection<java.lang.Boolean>
size
in interface java.util.List<java.lang.Boolean>
size
in class java.util.AbstractCollection<java.lang.Boolean>
public void size(int size)
BooleanList
If the specified size is smaller than the current size, the last elements are
discarded. Otherwise, they are filled with 0/null
/false
.
size
in interface BooleanList
size
in class AbstractBooleanList
size
- the new size.public void clear()
clear
in interface java.util.Collection<java.lang.Boolean>
clear
in interface java.util.List<java.lang.Boolean>
clear
in class java.util.AbstractCollection<java.lang.Boolean>
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean rem(boolean k)
BooleanCollection
remove()
, but the clash
with the similarly named index-based method in the List
interface
forces us to use a distinguished name. For simplicity, the set interfaces reinstates
remove()
.rem
in interface BooleanCollection
rem
in class AbstractBooleanList
Collection.remove(Object)
public boolean addAll(BooleanCollection c)
AbstractBooleanCollection
addAll
in interface BooleanCollection
addAll
in class AbstractBooleanList
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.addAll(Collection)
public boolean addAll(int i, BooleanCollection c)
AbstractBooleanList
addAll
in interface BooleanList
addAll
in class AbstractBooleanList
List.add(int,Object)