it.unimi.dsi.fastutil.objects
Class AbstractReferenceList

java.lang.Object
  extended byit.unimi.dsi.fastutil.objects.AbstractReferenceCollection
      extended byit.unimi.dsi.fastutil.objects.AbstractReferenceList
All Implemented Interfaces:
Collection, List, ReferenceCollection, ReferenceList
Direct Known Subclasses:
ReferenceArrayList

public abstract class AbstractReferenceList
extends AbstractReferenceCollection
implements ReferenceList

An abstract class providing basic methods for lists implementing a type-specific list interface.


Constructor Summary
AbstractReferenceList()
           
 
Method Summary
 void add(int index, Object k)
           
 boolean addAll(Collection c)
          Delegates to a more generic method.
 boolean addAll(int index, Collection c)
           
 boolean addAll(int index, ReferenceCollection c)
          Delegates to a more generic method.
 boolean addAll(int index, ReferenceList l)
          Delegates to a more generic method.
 boolean addAll(ReferenceCollection c)
          Delegates to a more generic method.
 boolean addAll(ReferenceList l)
          Delegates to a more generic method.
 boolean contains(Object k)
           
 boolean equals(Object o)
           
 void getElements(int from, Object[] a, int offset, int length)
          Copies element of this type-specific list into the given array one-by-one.
 int hashCode()
          Returns the hash code for this list, which is identical to List.hashCode().
 int indexOf(Object k)
           
 int lastIndexOf(Object k)
           
 ListIterator listIterator()
          Delegates to the corresponding type-specific method.
 ListIterator listIterator(int index)
          Delegates to the corresponding type-specific method.
 ObjectIterator objectIterator()
          Delegates to the corresponding list-iterator method.
 ObjectListIterator objectListIterator()
          Delegates to the corresponding list-iterator method.
 ReferenceList referenceSubList(int from, int to)
           
 void removeElements(int from, int to)
          Removes elements of this type-specific list one-by-one.
 Object set(int index, Object k)
           
 void size(int size)
          Sets the size of this list.
 List subList(int from, int to)
          Delegates to the corresponding type-specific method.
 String toString()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
add, containsAll, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ReferenceList
objectListIterator
 
Methods inherited from interface java.util.List
add, clear, containsAll, get, isEmpty, iterator, remove, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

AbstractReferenceList

public AbstractReferenceList()
Method Detail

add

public void add(int index,
                Object k)
Specified by:
add in interface List

set

public Object set(int index,
                  Object k)
Specified by:
set in interface List

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List

addAll

public boolean addAll(int index,
                      ReferenceCollection c)
Delegates to a more generic method.


addAll

public boolean addAll(int index,
                      ReferenceList l)
Delegates to a more generic method.


addAll

public boolean addAll(Collection c)
Delegates to a more generic method.

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

addAll

public boolean addAll(ReferenceCollection c)
Delegates to a more generic method.


addAll

public boolean addAll(ReferenceList l)
Delegates to a more generic method.


listIterator

public ListIterator listIterator()
Delegates to the corresponding type-specific method.

Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int index)
Delegates to the corresponding type-specific method.

Specified by:
listIterator in interface List

objectIterator

public ObjectIterator objectIterator()
Delegates to the corresponding list-iterator method.

Specified by:
objectIterator in interface ReferenceCollection
See Also:
Collection.iterator()

objectListIterator

public ObjectListIterator objectListIterator()
Delegates to the corresponding list-iterator method.

Specified by:
objectListIterator in interface ReferenceList
See Also:
List.listIterator()

contains

public boolean contains(Object k)
Specified by:
contains in interface List

indexOf

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

lastIndexOf

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

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
Parameters:
size - the new size.

referenceSubList

public ReferenceList referenceSubList(int from,
                                      int to)
Specified by:
referenceSubList in interface ReferenceList
See Also:
List.subList(int,int)

subList

public List subList(int from,
                    int to)
Delegates to the corresponding type-specific method.

Specified by:
subList in interface List

removeElements

public void removeElements(int from,
                           int to)
Removes elements of this type-specific list one-by-one.

This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimised version.

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

getElements

public void getElements(int from,
                        Object[] a,
                        int offset,
                        int length)
Copies element of this type-specific list into the given array one-by-one.

This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimised version.

Specified by:
getElements in interface ReferenceList
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.

equals

public boolean equals(Object o)
Specified by:
equals in interface List

hashCode

public int hashCode()
Returns the hash code for this list, which is identical to List.hashCode().

Specified by:
hashCode in interface List
Returns:
the hash code for this list.

toString

public String toString()
Overrides:
toString in class AbstractReferenceCollection