it.unimi.dsi.fastutil.doubles
Class DoubleLists.Singleton

java.lang.Object
  extended by java.util.AbstractCollection<Double>
      extended by it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
          extended by it.unimi.dsi.fastutil.doubles.AbstractDoubleList
              extended by it.unimi.dsi.fastutil.doubles.DoubleLists.Singleton
All Implemented Interfaces:
DoubleCollection, DoubleIterable, DoubleList, DoubleStack, Stack<Double>, Serializable, Cloneable, Comparable<List<? extends Double>>, Iterable<Double>, Collection<Double>, List<Double>
Enclosing class:
DoubleLists

public static class DoubleLists.Singleton
extends AbstractDoubleList
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.doubles.AbstractDoubleList
AbstractDoubleList.DoubleSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean addAll(Collection<? extends Double> c)
          Delegates to a more generic method.
 boolean addAll(DoubleCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(int i, Collection<? extends Double> c)
           
 boolean addAll(int i, DoubleCollection c)
          Delegates to a more generic method.
 void clear()
           
 Object clone()
           
 boolean contains(double k)
           
 double getDouble(int i)
           
 DoubleListIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 DoubleListIterator listIterator()
          Returns a type-specific list iterator on the list.
 DoubleListIterator listIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 boolean rem(double 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.
 double removeDouble(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.
 DoubleList 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.
 double[] toDoubleArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleList
add, add, add, addAll, addAll, addElements, addElements, compareTo, doubleListIterator, doubleListIterator, doubleSubList, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, peek, peekDouble, pop, popDouble, push, push, remove, remove, removeElements, set, set, top, topDouble, toString
 
Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
add, contains, containsAll, containsAll, doubleIterator, isEmpty, rem, removeAll, retainAll, toArray, toArray, toArray, toDoubleArray
 
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.doubles.DoubleCollection
containsAll, doubleIterator, removeAll, retainAll, toArray, toArray, toDoubleArray
 
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

getDouble

public double getDouble(int i)
Specified by:
getDouble in interface DoubleList
See Also:
List.get(int)

removeDouble

public double removeDouble(int i)
Specified by:
removeDouble in interface DoubleList
Overrides:
removeDouble in class AbstractDoubleList
See Also:
List.remove(int)

contains

public boolean contains(double k)
Specified by:
contains in interface DoubleCollection
Overrides:
contains in class AbstractDoubleList
See Also:
Collection.contains(Object)

addAll

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

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

addAll

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

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: AbstractDoubleCollection
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<Double>
Specified by:
removeAll in interface List<Double>
Overrides:
removeAll in class AbstractDoubleCollection
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: AbstractDoubleCollection
Retains in this collection only elements from the given collection.

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

toDoubleArray

public double[] toDoubleArray()
Description copied from interface: DoubleCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toDoubleArray in interface DoubleCollection
Overrides:
toDoubleArray in class AbstractDoubleCollection
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

listIterator

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

Specified by:
listIterator in interface DoubleList
Specified by:
listIterator in interface List<Double>
Overrides:
listIterator in class AbstractDoubleList
See Also:
List.listIterator()

iterator

public DoubleListIterator iterator()
Description copied from interface: DoubleCollection
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 DoubleCollection
Specified by:
iterator in interface DoubleIterable
Specified by:
iterator in interface DoubleList
Specified by:
iterator in interface Iterable<Double>
Specified by:
iterator in interface Collection<Double>
Specified by:
iterator in interface List<Double>
Overrides:
iterator in class AbstractDoubleList
Returns:
a type-specific iterator on the elements of this collection.

listIterator

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

Specified by:
listIterator in interface DoubleList
Specified by:
listIterator in interface List<Double>
Overrides:
listIterator in class AbstractDoubleList
See Also:
List.listIterator(int)

subList

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

size

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

size

public void size(int size)
Description copied from interface: DoubleList
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 DoubleList
Overrides:
size in class AbstractDoubleList
Parameters:
size - the new size.

clear

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

clone

public Object clone()
Overrides:
clone in class Object

rem

public boolean rem(double k)
Description copied from interface: DoubleCollection
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 DoubleCollection
Overrides:
rem in class AbstractDoubleList
See Also:
Collection.remove(Object)

addAll

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

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

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