it.unimi.dsi.fastutil.chars
Class CharLists.Singleton

java.lang.Object
  extended byit.unimi.dsi.fastutil.chars.AbstractCharCollection
      extended byit.unimi.dsi.fastutil.chars.AbstractCharList
          extended byit.unimi.dsi.fastutil.chars.CharLists.Singleton
All Implemented Interfaces:
CharCollection, CharList, CharStack, Cloneable, Collection, Comparable, List, Serializable, Stack
Enclosing class:
CharLists

public static class CharLists.Singleton
extends AbstractCharList
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 inherited from class it.unimi.dsi.fastutil.chars.AbstractCharList
AbstractCharList.CharSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(char k)
           
 void add(int i, char k)
           
 boolean addAll(CharCollection c)
          Delegates to a more generic method.
 boolean addAll(CharList c)
          Delegates to a more generic method.
 boolean addAll(Collection c)
          Delegates to a more generic method.
 boolean addAll(int i, CharCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, CharList c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection c)
           
 boolean addAll(int i, List c)
           
 boolean addAll(List c)
           
 CharListIterator charListIterator()
          Delegates to the corresponding list-iterator method.
 CharListIterator charListIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 CharList charSubList(int from, int to)
           
 void clear()
           
 Object clone()
           
 boolean contains(char k)
           
 char getChar(int i)
           
 boolean rem(char 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(CharCollection c)
          Remove from this collection all elements in the given type-specific collection.
 boolean removeAll(Collection c)
          Remove from this collection all elements in the given collection.
 char removeChar(int i)
           
 boolean retainAll(CharCollection c)
          Retains in this collection only elements from the given type-specific collection.
 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.
 char[] toCharArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharList
add, addElements, addElements, charIterator, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekChar, pop, popChar, push, push, remove, removeElements, set, set, subList, top, topChar, toString
 
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection
add, contains, containsAll, containsAll, isEmpty, iterator, rem, remove, toArray, toArray, toArray, toCharArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, iterator, remove, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection
containsAll, toArray, toCharArray
 
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

rem

public boolean rem(char k)
Description copied from interface: CharCollection
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 CharCollection
Overrides:
rem in class AbstractCharList

add

public boolean add(char k)
Specified by:
add in interface CharCollection
Overrides:
add in class AbstractCharList

add

public void add(int i,
                char k)
Specified by:
add in interface CharList
Overrides:
add in class AbstractCharList

getChar

public char getChar(int i)
Specified by:
getChar in interface CharList
See Also:
List.get(int)

removeChar

public char removeChar(int i)
Specified by:
removeChar in interface CharList
Overrides:
removeChar in class AbstractCharList

contains

public boolean contains(char k)
Specified by:
contains in interface CharCollection
Overrides:
contains in class AbstractCharList

addAll

public boolean addAll(CharList c)
Description copied from class: AbstractCharList
Delegates to a more generic method.

Specified by:
addAll in interface CharList
Overrides:
addAll in class AbstractCharList

addAll

public boolean addAll(CharCollection c)
Description copied from class: AbstractCharList
Delegates to a more generic method.

Specified by:
addAll in interface CharCollection
Overrides:
addAll in class AbstractCharList

addAll

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

Specified by:
addAll in interface CharList
Overrides:
addAll in class AbstractCharList

addAll

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

Specified by:
addAll in interface CharList
Overrides:
addAll in class AbstractCharList

removeAll

public boolean removeAll(CharCollection c)
Description copied from class: AbstractCharCollection
Remove from this collection all elements in the given type-specific collection.

Specified by:
removeAll in interface CharCollection
Overrides:
removeAll in class AbstractCharCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(CharCollection c)
Description copied from class: AbstractCharCollection
Retains in this collection only elements from the given type-specific collection.

Specified by:
retainAll in interface CharCollection
Overrides:
retainAll in class AbstractCharCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(List c)

addAll

public boolean addAll(Collection c)
Description copied from class: AbstractCharList
Delegates to a more generic method.

Specified by:
addAll in interface List
Overrides:
addAll in class AbstractCharList

addAll

public boolean addAll(int i,
                      List c)

addAll

public boolean addAll(int i,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class AbstractCharList

removeAll

public boolean removeAll(Collection c)
Description copied from class: AbstractCharCollection
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 List
Overrides:
removeAll in class AbstractCharCollection
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: AbstractCharCollection
Retains in this collection only elements from the given collection.

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

toCharArray

public char[] toCharArray()
Description copied from interface: CharCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toCharArray in interface CharCollection
Overrides:
toCharArray in class AbstractCharCollection

charListIterator

public CharListIterator charListIterator()
Description copied from class: AbstractCharList
Delegates to the corresponding list-iterator method.

Specified by:
charListIterator in interface CharList
Overrides:
charListIterator in class AbstractCharList

charListIterator

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

The iterator returned by the List.listIterator() method and by this method are identical; however, using this method you can save a type casting.

Specified by:
charListIterator in interface CharList
Overrides:
charListIterator in class AbstractCharList

charSubList

public CharList charSubList(int from,
                            int to)
Specified by:
charSubList in interface CharList
Overrides:
charSubList in class AbstractCharList

size

public int size()
Specified by:
size in interface List

size

public void size(int size)
Description copied from interface: CharList
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 CharList
Overrides:
size in class AbstractCharList

clear

public void clear()
Specified by:
clear in interface List
Overrides:
clear in class AbstractCharCollection

clone

public Object clone()