it.unimi.dsi.fastutil.longs
Class LongLists.Singleton

java.lang.Object
  extended byit.unimi.dsi.fastutil.longs.AbstractLongCollection
      extended byit.unimi.dsi.fastutil.longs.AbstractLongList
          extended byit.unimi.dsi.fastutil.longs.LongLists.Singleton
All Implemented Interfaces:
Cloneable, Collection, Comparable, List, LongCollection, LongList, LongStack, Serializable, Stack
Enclosing class:
LongLists

public static class LongLists.Singleton
extends AbstractLongList
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.longs.AbstractLongList
AbstractLongList.LongSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 void add(int i, long k)
           
 boolean add(long k)
           
 boolean addAll(Collection c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection c)
           
 boolean addAll(int i, List c)
           
 boolean addAll(int i, LongCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, LongList c)
          Delegates to a more generic method.
 boolean addAll(List c)
           
 boolean addAll(LongCollection c)
          Delegates to a more generic method.
 boolean addAll(LongList c)
          Delegates to a more generic method.
 void clear()
           
 Object clone()
           
 boolean contains(long k)
           
 long getLong(int i)
           
 LongListIterator longListIterator()
          Delegates to the corresponding list-iterator method.
 LongListIterator longListIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 LongList longSubList(int from, int to)
           
 boolean rem(long 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.
 boolean removeAll(LongCollection c)
          Remove from this collection all elements in the given type-specific collection.
 long removeLong(int i)
           
 boolean retainAll(Collection c)
          Retains in this collection only elements from the given collection.
 boolean retainAll(LongCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 void size(int size)
          Sets the size of this list.
 long[] toLongArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongList
add, addElements, addElements, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, longIterator, peek, peekLong, pop, popLong, push, push, remove, removeElements, set, set, subList, top, topLong, toString
 
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, contains, containsAll, containsAll, isEmpty, iterator, rem, remove, toArray, toArray, toArray, toLongArray
 
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.longs.LongCollection
containsAll, toArray, toLongArray
 
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(long k)
Description copied from interface: LongCollection
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 LongCollection
Overrides:
rem in class AbstractLongList

add

public boolean add(long k)
Specified by:
add in interface LongCollection
Overrides:
add in class AbstractLongList

add

public void add(int i,
                long k)
Specified by:
add in interface LongList
Overrides:
add in class AbstractLongList

getLong

public long getLong(int i)
Specified by:
getLong in interface LongList
See Also:
List.get(int)

removeLong

public long removeLong(int i)
Specified by:
removeLong in interface LongList
Overrides:
removeLong in class AbstractLongList

contains

public boolean contains(long k)
Specified by:
contains in interface LongCollection
Overrides:
contains in class AbstractLongList

addAll

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

Specified by:
addAll in interface LongList
Overrides:
addAll in class AbstractLongList

addAll

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

Specified by:
addAll in interface LongCollection
Overrides:
addAll in class AbstractLongList

addAll

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

Specified by:
addAll in interface LongList
Overrides:
addAll in class AbstractLongList

addAll

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

Specified by:
addAll in interface LongList
Overrides:
addAll in class AbstractLongList

removeAll

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

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

retainAll

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

Specified by:
retainAll in interface LongCollection
Overrides:
retainAll in class AbstractLongCollection
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: AbstractLongList
Delegates to a more generic method.

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

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 AbstractLongList

removeAll

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

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

toLongArray

public long[] toLongArray()
Description copied from interface: LongCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toLongArray in interface LongCollection
Overrides:
toLongArray in class AbstractLongCollection

longListIterator

public LongListIterator longListIterator()
Description copied from class: AbstractLongList
Delegates to the corresponding list-iterator method.

Specified by:
longListIterator in interface LongList
Overrides:
longListIterator in class AbstractLongList

longListIterator

public LongListIterator longListIterator(int i)
Description copied from interface: LongList
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:
longListIterator in interface LongList
Overrides:
longListIterator in class AbstractLongList

longSubList

public LongList longSubList(int from,
                            int to)
Specified by:
longSubList in interface LongList
Overrides:
longSubList in class AbstractLongList

size

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

size

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

clear

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

clone

public Object clone()