it.unimi.dsi.fastutil.objects
Class ReferenceLists.Singleton<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.AbstractReferenceList<K>
              extended by it.unimi.dsi.fastutil.objects.ReferenceLists.Singleton<K>
All Implemented Interfaces:
ObjectIterable<K>, ReferenceCollection<K>, ReferenceList<K>, Stack<K>, Serializable, Cloneable, Iterable<K>, Collection<K>, List<K>
Enclosing class:
ReferenceLists

public static class ReferenceLists.Singleton<K>
extends AbstractReferenceList<K>
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.objects.AbstractReferenceList
AbstractReferenceList.ReferenceSubList<K>
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean addAll(Collection<? extends K> c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection<? extends K> c)
           
 void clear()
           
 Object clone()
           
 boolean contains(Object k)
           
 K get(int i)
           
 ObjectListIterator<K> iterator()
          Returns a type-specific iterator on the elements of this collection.
 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.
 K remove(int i)
           
 boolean remove(Object k)
           
 boolean removeAll(Collection<?> c)
          Remove from this collection all elements in the given 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.
 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.
 Object[] toArray()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceList
add, add, addElements, addElements, ensureIndex, ensureRestrictedIndex, equals, getElements, hashCode, indexOf, lastIndexOf, objectListIterator, objectListIterator, peek, pop, push, referenceSubList, removeElements, set, top, toString
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
containsAll, isEmpty, objectIterator, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, isEmpty, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ReferenceCollection
objectIterator, toArray
 
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

get

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

remove

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

contains

public boolean contains(Object k)
Specified by:
contains in interface Collection<K>
Specified by:
contains in interface List<K>
Overrides:
contains in class AbstractReferenceList<K>

addAll

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

Specified by:
addAll in interface Collection<K>
Specified by:
addAll in interface List<K>
Overrides:
addAll in class AbstractReferenceList<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>
Overrides:
addAll in class AbstractReferenceList<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.

retainAll

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

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

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<K>
Specified by:
toArray in interface List<K>
Overrides:
toArray in class AbstractReferenceCollection<K>

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>
Overrides:
listIterator in class AbstractReferenceList<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 AbstractReferenceList<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>
Overrides:
listIterator in class AbstractReferenceList<K>
See Also:
List.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>
Overrides:
subList in class AbstractReferenceList<K>
See Also:
List.subList(int,int)

size

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

size

public void size(int size)
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>
Overrides:
size in class AbstractReferenceList<K>
Parameters:
size - the new size.

clear

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

clone

public Object clone()
Overrides:
clone in class Object

remove

public boolean remove(Object k)
Specified by:
remove in interface Collection<K>
Specified by:
remove in interface List<K>
Overrides:
remove in class AbstractCollection<K>


Copyright © 2011. All Rights Reserved.