it.unimi.dsi.fastutil.objects
Class ReferenceLists.EmptyList<K>

java.lang.Object
  extended by java.util.AbstractCollection<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>
          extended by it.unimi.dsi.fastutil.objects.ReferenceCollections.EmptyCollection<K>
              extended by it.unimi.dsi.fastutil.objects.ReferenceLists.EmptyList<K>
All Implemented Interfaces:
ObjectIterable<K>, ReferenceCollection<K>, ReferenceList<K>, Serializable, Cloneable, Iterable<K>, Collection<K>, List<K>
Enclosing class:
ReferenceLists

public static class ReferenceLists.EmptyList<K>
extends ReferenceCollections.EmptyCollection<K>
implements ReferenceList<K>, 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
 void add(int index, K k)
           
 boolean add(K k)
           
 boolean addAll(Collection<? extends K> c)
          Adds all elements of the given collection to this collection.
 boolean addAll(int i, Collection<? extends K> c)
           
 void addElements(int index, K[] a)
          Add (hopefully quickly) elements to this type-specific list.
 void addElements(int index, K[] a, int offset, int length)
          Add (hopefully quickly) elements to this type-specific list.
 Object clone()
           
 int compareTo(List<? extends K> o)
           
 K get(int i)
           
 void getElements(int from, Object[] a, int offset, int length)
          Copies (hopefully quickly) elements of this type-specific list into the given array.
 int indexOf(Object k)
           
 ObjectListIterator<K> iterator()
          Returns a type-specific iterator on the elements of this collection.
 int lastIndexOf(Object k)
           
 ObjectListIterator<K> listIterator()
          Returns a type-specific list iterator on the list.
 ObjectListIterator<K> listIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 ObjectIterator<K> objectIterator()
          Deprecated. 
 ObjectListIterator<K> objectListIterator()
          Deprecated. 
 ObjectListIterator<K> objectListIterator(int i)
          Deprecated. 
 ReferenceList<K> referenceSubList(int from, int to)
          Deprecated. 
 K remove(int i)
           
 boolean removeAll(Collection<?> c)
          Remove from this collection all elements in the given collection.
 void removeElements(int from, int to)
          Removes (hopefully quickly) elements of this type-specific list.
 K set(int index, K k)
           
 void size(int s)
          Sets the size of this list.
 ReferenceList<K> 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.objects.ReferenceCollections.EmptyCollection
clear, contains, equals, hashCode, remove, size, toArray, toArray
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
containsAll, isEmpty, retainAll, 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.objects.ReferenceCollection
toArray
 

Field Detail

serialVersionUID

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

add

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

add

public boolean add(K k)
Specified by:
add in interface Collection<K>
Specified by:
add in interface List<K>
Overrides:
add in class ReferenceCollections.EmptyCollection<K>

remove

public K remove(int i)
Specified by:
remove in interface List<K>

set

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

indexOf

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

lastIndexOf

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

addAll

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

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

addAll

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

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: AbstractReferenceCollection
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<K>
Specified by:
removeAll in interface List<K>
Overrides:
removeAll in class AbstractReferenceCollection<K>
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

get

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

objectIterator

@Deprecated
public ObjectIterator<K> objectIterator()
Deprecated. 

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

Specified by:
objectIterator in interface ReferenceCollection<K>
Overrides:
objectIterator in class AbstractReferenceCollection<K>
See Also:
ReferenceCollection.iterator()

listIterator

public ObjectListIterator<K> listIterator()
Description copied from interface: ReferenceList
Returns a type-specific list iterator on the list.

Specified by:
listIterator in interface ReferenceList<K>
Specified by:
listIterator in interface List<K>
See Also:
List.listIterator()

iterator

public ObjectListIterator<K> iterator()
Description copied from interface: ReferenceCollection
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 ObjectIterable<K>
Specified by:
iterator in interface ReferenceCollection<K>
Specified by:
iterator in interface ReferenceList<K>
Specified by:
iterator in interface Iterable<K>
Specified by:
iterator in interface Collection<K>
Specified by:
iterator in interface List<K>
Overrides:
iterator in class ReferenceCollections.EmptyCollection<K>
Returns:
a type-specific iterator on the elements of this collection.

listIterator

public ObjectListIterator<K> listIterator(int i)
Description copied from interface: ReferenceList
Returns a type-specific list iterator on the list starting at a given index.

Specified by:
listIterator in interface ReferenceList<K>
Specified by:
listIterator in interface List<K>
See Also:
List.listIterator(int)

objectListIterator

@Deprecated
public ObjectListIterator<K> objectListIterator()
Deprecated. 

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

Specified by:
objectListIterator in interface ReferenceList<K>
See Also:
ReferenceList.listIterator()

objectListIterator

@Deprecated
public ObjectListIterator<K> objectListIterator(int i)
Deprecated. 

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

Specified by:
objectListIterator in interface ReferenceList<K>
See Also:
ReferenceList.listIterator(int)

subList

public ReferenceList<K> subList(int from,
                                int to)
Description copied from interface: ReferenceList
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 ReferenceList<K>
Specified by:
subList in interface List<K>
See Also:
List.subList(int,int)

referenceSubList

@Deprecated
public ReferenceList<K> referenceSubList(int from,
                                                    int to)
Deprecated. 

Description copied from interface: ReferenceList
Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.

Specified by:
referenceSubList in interface ReferenceList<K>
See Also:
List.subList(int,int)

getElements

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

Specified by:
getElements in interface ReferenceList<K>
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: ReferenceList
Removes (hopefully quickly) elements of this type-specific list.

Specified by:
removeElements in interface ReferenceList<K>
Parameters:
from - the start index (inclusive).
to - the end index (exclusive).

addElements

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

Specified by:
addElements in interface ReferenceList<K>
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,
                        K[] a)
Description copied from interface: ReferenceList
Add (hopefully quickly) elements to this type-specific list.

Specified by:
addElements in interface ReferenceList<K>
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: ReferenceList
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 ReferenceList<K>
Parameters:
s - the new size.

compareTo

public int compareTo(List<? extends K> o)

clone

public Object clone()
Overrides:
clone in class Object