it.unimi.dsi.fastutil.booleans
Class BooleanLists.Singleton

java.lang.Object
  extended by java.util.AbstractCollection<Boolean>
      extended by it.unimi.dsi.fastutil.booleans.AbstractBooleanCollection
          extended by it.unimi.dsi.fastutil.booleans.AbstractBooleanList
              extended by it.unimi.dsi.fastutil.booleans.BooleanLists.Singleton
All Implemented Interfaces:
BooleanCollection, BooleanIterable, BooleanList, BooleanStack, Stack<Boolean>, Serializable, Cloneable, Comparable<List<? extends Boolean>>, Iterable<Boolean>, Collection<Boolean>, List<Boolean>
Enclosing class:
BooleanLists

public static class BooleanLists.Singleton
extends AbstractBooleanList
implements Serializable, Cloneable

An immutable class representing a type-specific singleton list.

This class may be useful to implement your own in case you subclass a type-specific list.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanList
AbstractBooleanList.BooleanSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean addAll(BooleanCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(Collection<? extends Boolean> c)
          Delegates to a more generic method.
 boolean addAll(int i, BooleanCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection<? extends Boolean> c)
           
 void clear()
           
 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(Collection<?> c)
          Remove from this collection all elements in the given collection.
 boolean removeBoolean(int i)
           
 boolean retainAll(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.
 
Methods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanList
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
 
Methods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanCollection
add, booleanIterator, contains, containsAll, containsAll, isEmpty, rem, removeAll, retainAll, toArray, toArray, toArray, toBooleanArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanCollection
booleanIterator, containsAll, removeAll, retainAll, toArray, toArray, toBooleanArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Method Detail

getBoolean

public boolean getBoolean(int i)
Specified by:
getBoolean in interface BooleanList
See Also:
List.get(int)

removeBoolean

public boolean removeBoolean(int i)
Specified by:
removeBoolean in interface BooleanList
Overrides:
removeBoolean in class AbstractBooleanList
See Also:
List.remove(int)

contains

public boolean contains(boolean k)
Specified by:
contains in interface BooleanCollection
Overrides:
contains in class AbstractBooleanList
See Also:
Collection.contains(Object)

addAll

public boolean addAll(Collection<? extends Boolean> c)
Description copied from class: AbstractBooleanList
Delegates to a more generic method.

Specified by:
addAll in interface Collection<Boolean>
Specified by:
addAll in interface List<Boolean>
Overrides:
addAll in class AbstractBooleanList
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(int i,
                      Collection<? extends Boolean> c)
Specified by:
addAll in interface List<Boolean>
Overrides:
addAll in class AbstractBooleanList

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: AbstractBooleanCollection
Remove from this collection all elements in the given collection. If the collection is an instance of this class, it uses faster iterators.

Specified by:
removeAll in interface Collection<Boolean>
Specified by:
removeAll in interface List<Boolean>
Overrides:
removeAll in class AbstractBooleanCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(Collection<?> c)
Description copied from class: AbstractBooleanCollection
Retains in this collection only elements from the given collection.

Specified by:
retainAll in interface Collection<Boolean>
Specified by:
retainAll in interface List<Boolean>
Overrides:
retainAll in class AbstractBooleanCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

toBooleanArray

public boolean[] toBooleanArray()
Description copied from interface: BooleanCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toBooleanArray in interface BooleanCollection
Overrides:
toBooleanArray in class AbstractBooleanCollection
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

listIterator

public BooleanListIterator listIterator()
Description copied from interface: BooleanList
Returns a type-specific list iterator on the list.

Specified by:
listIterator in interface BooleanList
Specified by:
listIterator in interface List<Boolean>
Overrides:
listIterator in class AbstractBooleanList
See Also:
List.listIterator()

iterator

public BooleanListIterator iterator()
Description copied from interface: BooleanCollection
Returns a type-specific iterator on the elements of this collection.

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.

Specified by:
iterator in interface BooleanCollection
Specified by:
iterator in interface BooleanIterable
Specified by:
iterator in interface BooleanList
Specified by:
iterator in interface Iterable<Boolean>
Specified by:
iterator in interface Collection<Boolean>
Specified by:
iterator in interface List<Boolean>
Overrides:
iterator in class AbstractBooleanList
Returns:
a type-specific iterator on the elements of this collection.

listIterator

public BooleanListIterator listIterator(int i)
Description copied from interface: BooleanList
Returns a type-specific list iterator on the list starting at a given index.

Specified by:
listIterator in interface BooleanList
Specified by:
listIterator in interface List<Boolean>
Overrides:
listIterator in class AbstractBooleanList
See Also:
List.listIterator(int)

subList

public BooleanList subList(int from,
                           int to)
Description copied from interface: BooleanList
Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.

Note that this specification strengthens the one given in List.subList(int,int).

Specified by:
subList in interface BooleanList
Specified by:
subList in interface List<Boolean>
Overrides:
subList in class AbstractBooleanList
See Also:
List.subList(int,int)

size

public int size()
Specified by:
size in interface Collection<Boolean>
Specified by:
size in interface List<Boolean>
Specified by:
size in class AbstractCollection<Boolean>

size

public void size(int size)
Description copied from interface: BooleanList
Sets the size of this list.

If the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/null/false.

Specified by:
size in interface BooleanList
Overrides:
size in class AbstractBooleanList
Parameters:
size - the new size.

clear

public void clear()
Specified by:
clear in interface Collection<Boolean>
Specified by:
clear in interface List<Boolean>
Overrides:
clear in class AbstractCollection<Boolean>

clone

public Object clone()
Overrides:
clone in class Object

rem

public boolean rem(boolean k)
Description copied from interface: BooleanCollection
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. For simplicity, the set interfaces reinstates remove().

Specified by:
rem in interface BooleanCollection
Overrides:
rem in class AbstractBooleanList
See Also:
Collection.remove(Object)

addAll

public boolean addAll(BooleanCollection c)
Description copied from class: AbstractBooleanCollection
Adds all elements of the given type-specific collection to this collection.

Specified by:
addAll in interface BooleanCollection
Overrides:
addAll in class AbstractBooleanList
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.
See Also:
Collection.addAll(Collection)

addAll

public boolean addAll(int i,
                      BooleanCollection c)
Description copied from class: AbstractBooleanList
Delegates to a more generic method.

Specified by:
addAll in interface BooleanList
Overrides:
addAll in class AbstractBooleanList
See Also:
List.add(int,Object)