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

java.lang.Object
  extended by java.util.AbstractCollection<Character>
      extended by it.unimi.dsi.fastutil.chars.AbstractCharCollection
          extended by it.unimi.dsi.fastutil.chars.CharCollections.EmptyCollection
              extended by it.unimi.dsi.fastutil.chars.CharLists.EmptyList
All Implemented Interfaces:
CharCollection, CharIterable, CharList, Serializable, Cloneable, Comparable<List<? extends Character>>, Iterable<Character>, Collection<Character>, List<Character>
Enclosing class:
CharLists

public static class CharLists.EmptyList
extends CharCollections.EmptyCollection
implements CharList, Serializable, Cloneable

An immutable class representing an empty type-specific list.

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

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(char k)
           
 boolean add(Character k)
          Delegates to the corresponding type-specific method.
 void add(int index, char k)
           
 void add(int index, Character k)
           
 boolean addAll(CharCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(CharList c)
           
 boolean addAll(Collection<? extends Character> c)
          Adds all elements of the given collection to this collection.
 boolean addAll(int i, CharCollection c)
           
 boolean addAll(int i, CharList c)
           
 boolean addAll(int i, Collection<? extends Character> c)
           
 void addElements(int index, char[] a)
          Add (hopefully quickly) elements to this type-specific list.
 void addElements(int index, char[] a, int offset, int length)
          Add (hopefully quickly) elements to this type-specific list.
 CharIterator charIterator()
          Deprecated. 
 CharListIterator charListIterator()
          Deprecated. 
 CharListIterator charListIterator(int i)
          Deprecated. 
 CharList charSubList(int from, int to)
          Deprecated. 
 Object clone()
           
 int compareTo(List<? extends Character> o)
           
 Character get(int i)
           
 char getChar(int i)
           
 void getElements(int from, char[] a, int offset, int length)
          Copies (hopefully quickly) elements of this type-specific list into the given array.
 int indexOf(char k)
           
 int indexOf(Object k)
           
 CharListIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 int lastIndexOf(char k)
           
 int lastIndexOf(Object k)
           
 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.
 Character remove(int k)
           
 boolean removeAll(Collection<?> c)
          Remove from this collection all elements in the given collection.
 char removeChar(int i)
           
 void removeElements(int from, int to)
          Removes (hopefully quickly) elements of this type-specific list.
 char set(int index, char k)
           
 Character set(int index, Character k)
           
 void size(int s)
          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.
 
Methods inherited from class it.unimi.dsi.fastutil.chars.CharCollections.EmptyCollection
clear, contains, containsAll, equals, hashCode, rem, removeAll, retainAll, size, toArray, toCharArray, toCharArray
 
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection
contains, containsAll, isEmpty, rem, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
clear, contains, containsAll, equals, hashCode, isEmpty, remove, retainAll, size, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection
contains, containsAll, rem, removeAll, retainAll, toArray, toArray, toCharArray, toCharArray
 

Field Detail

serialVersionUID

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

add

public void add(int index,
                char k)
Specified by:
add in interface CharList
See Also:
List.add(int,Object)

add

public boolean add(char k)
Specified by:
add in interface CharCollection
Specified by:
add in interface CharList
Overrides:
add in class CharCollections.EmptyCollection
See Also:
Collection.add(Object)

removeChar

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

set

public char set(int index,
                char k)
Specified by:
set in interface CharList
See Also:
List.set(int,Object)

indexOf

public int indexOf(char k)
Specified by:
indexOf in interface CharList
See Also:
List.indexOf(Object)

lastIndexOf

public int lastIndexOf(char k)
Specified by:
lastIndexOf in interface CharList
See Also:
List.lastIndexOf(Object)

addAll

public boolean addAll(Collection<? extends Character> c)
Description copied from class: AbstractCharCollection
Adds all elements of the given collection to this collection.

Specified by:
addAll in interface Collection<Character>
Specified by:
addAll in interface List<Character>
Overrides:
addAll in class AbstractCharCollection
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>

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.

get

public Character get(int i)
Specified by:
get in interface List<Character>

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 CharCollections.EmptyCollection
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(CharList c)
Specified by:
addAll in interface CharList
See Also:
List.add(int,Object)

addAll

public boolean addAll(int i,
                      CharCollection c)
Specified by:
addAll in interface CharList
See Also:
List.add(int,Object)

addAll

public boolean addAll(int i,
                      CharList c)
Specified by:
addAll in interface CharList
See Also:
List.add(int,Object)

add

public void add(int index,
                Character k)
Specified by:
add in interface List<Character>

add

public boolean add(Character k)
Description copied from class: AbstractCharCollection
Delegates to the corresponding type-specific method.

Specified by:
add in interface Collection<Character>
Specified by:
add in interface List<Character>
Overrides:
add in class AbstractCharCollection

set

public Character set(int index,
                     Character k)
Specified by:
set in interface List<Character>

getChar

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

remove

public Character remove(int k)
Specified by:
remove in interface List<Character>

indexOf

public int indexOf(Object k)
Specified by:
indexOf in interface List<Character>

lastIndexOf

public int lastIndexOf(Object k)
Specified by:
lastIndexOf in interface List<Character>

charIterator

@Deprecated
public CharIterator charIterator()
Deprecated. 

Description copied from class: AbstractCharCollection
Delegates to the new covariantly stronger generic method.

Specified by:
charIterator in interface CharCollection
Overrides:
charIterator in class AbstractCharCollection
See Also:
CharCollection.iterator()

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

iterator

public CharListIterator iterator()
Description copied from interface: CharCollection
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 CharCollection
Specified by:
iterator in interface CharIterable
Specified by:
iterator in interface CharList
Specified by:
iterator in interface Iterable<Character>
Specified by:
iterator in interface Collection<Character>
Specified by:
iterator in interface List<Character>
Overrides:
iterator in class CharCollections.EmptyCollection
Returns:
a type-specific iterator on the elements of this collection.

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

charListIterator

@Deprecated
public CharListIterator charListIterator()
Deprecated. 

Description copied from interface: CharList
Returns a type-specific list iterator on the list.

Specified by:
charListIterator in interface CharList
See Also:
CharList.listIterator()

charListIterator

@Deprecated
public CharListIterator charListIterator(int i)
Deprecated. 

Description copied from interface: CharList
Returns a type-specific list iterator on the list starting at a given index.

Specified by:
charListIterator in interface CharList
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>
See Also:
List.subList(int,int)

charSubList

@Deprecated
public CharList charSubList(int from,
                                       int to)
Deprecated. 

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.

Specified by:
charSubList in interface CharList
See Also:
List.subList(int,int)

getElements

public void getElements(int from,
                        char[] a,
                        int offset,
                        int length)
Description copied from interface: CharList
Copies (hopefully quickly) elements of this type-specific list into the given array.

Specified by:
getElements in interface CharList
Parameters:
from - the start index (inclusive).
a - the destination array.
offset - the offset into the destination array where to store the first element copied.
length - the number of elements to be copied.

removeElements

public void removeElements(int from,
                           int to)
Description copied from interface: CharList
Removes (hopefully quickly) elements of this type-specific list.

Specified by:
removeElements in interface CharList
Parameters:
from - the start index (inclusive).
to - the end index (exclusive).

addElements

public void addElements(int index,
                        char[] a,
                        int offset,
                        int length)
Description copied from interface: CharList
Add (hopefully quickly) elements to this type-specific list.

Specified by:
addElements in interface CharList
Parameters:
index - the index at which to add elements.
a - the array containing the elements.
offset - the offset of the first element to add.
length - the number of elements to add.

addElements

public void addElements(int index,
                        char[] a)
Description copied from interface: CharList
Add (hopefully quickly) elements to this type-specific list.

Specified by:
addElements in interface CharList
Parameters:
index - the index at which to add elements.
a - the array containing the elements.

size

public void size(int s)
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
Parameters:
s - the new size.

compareTo

public int compareTo(List<? extends Character> o)
Specified by:
compareTo in interface Comparable<List<? extends Character>>

clone

public Object clone()
Overrides:
clone in class Object