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

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

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
See Also:
List.remove(int)

contains

public boolean contains(char k)
Specified by:
contains in interface CharCollection
Overrides:
contains in class AbstractCharList
See Also:
Collection.contains(Object)

addAll

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

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

addAll

public boolean addAll(int i,
                      Collection<? extends Character> c)
Specified by:
addAll in interface List<Character>
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 Collection<Character>
Specified by:
removeAll in interface List<Character>
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 Collection<Character>
Specified by:
retainAll in interface List<Character>
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
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

listIterator

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

Specified by:
listIterator in interface CharList
Specified by:
listIterator in interface List<Character>
Overrides:
listIterator in class AbstractCharList
See Also:
CharList.listIterator()

listIterator

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

Specified by:
listIterator in interface CharList
Specified by:
listIterator in interface List<Character>
Overrides:
listIterator in class AbstractCharList
See Also:
CharList.listIterator(int)

subList

public CharList subList(int from,
                        int to)
Description copied from interface: CharList
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 CharList
Specified by:
subList in interface List<Character>
Overrides:
subList in class AbstractCharList
See Also:
List.subList(int,int)

size

public int size()
Specified by:
size in interface Collection<Character>
Specified by:
size in interface List<Character>

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
Parameters:
size - the new size.

clear

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

clone

public Object clone()
Overrides:
clone in class Object

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
See Also:
Collection.remove(Object)

addAll

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

Specified by:
addAll in interface CharCollection
Overrides:
addAll in class AbstractCharList
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,
                      CharCollection c)
Description copied from class: AbstractCharList
Delegates to a more generic method.

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