it.unimi.dsi.fastutil.shorts
Class AbstractShortList.ShortSubList

java.lang.Object
  extended byit.unimi.dsi.fastutil.shorts.AbstractShortCollection
      extended byit.unimi.dsi.fastutil.shorts.AbstractShortList
          extended byit.unimi.dsi.fastutil.shorts.AbstractShortList.ShortSubList
All Implemented Interfaces:
Collection, Comparable, List, Serializable, ShortCollection, ShortList, ShortStack, Stack
Enclosing class:
AbstractShortList

public static class AbstractShortList.ShortSubList
extends AbstractShortList
implements Serializable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortList
AbstractShortList.ShortSubList
 
Constructor Summary
AbstractShortList.ShortSubList(ShortList l, int from, int to)
           
 
Method Summary
 void add(int index, short k)
           
 boolean add(short k)
           
 boolean addAll(int index, Collection c)
           
 boolean addAll(int index, ShortCollection c)
          Delegates to a more generic method.
 boolean addAll(int index, ShortList l)
          Delegates to a more generic method.
 void addElements(int index, short[] a, int offset, int length)
          Adds elements to this type-specific list one-by-one.
 void clear()
           
 void getElements(int from, short[] a, int offset, int length)
          Copies element of this type-specific list into the given array one-by-one.
 short getShort(int index)
           
 boolean rem(short 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.
 void removeElements(int from, int to)
          Removes elements of this type-specific list one-by-one.
 short removeShort(int index)
           
 short set(int index, short k)
           
 ShortListIterator shortListIterator(int index)
          Returns a type-specific list iterator on the list starting at a given index.
 ShortList shortSubList(int from, int to)
           
 int size()
           
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortList
add, addAll, addAll, addAll, addElements, compareTo, contains, equals, get, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekShort, pop, popShort, push, push, remove, set, shortIterator, shortListIterator, size, subList, top, topShort, toString
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
add, contains, containsAll, containsAll, isEmpty, iterator, rem, remove, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toShortArray, toShortArray
 
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, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortCollection
containsAll, removeAll, retainAll, toArray, toShortArray, toShortArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Constructor Detail

AbstractShortList.ShortSubList

public AbstractShortList.ShortSubList(ShortList l,
                                      int from,
                                      int to)
Method Detail

add

public boolean add(short k)
Specified by:
add in interface ShortCollection
Overrides:
add in class AbstractShortList

add

public void add(int index,
                short k)
Specified by:
add in interface ShortList
Overrides:
add in class AbstractShortList

addAll

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

addAll

public boolean addAll(int index,
                      ShortCollection c)
Description copied from class: AbstractShortList
Delegates to a more generic method.

Specified by:
addAll in interface ShortList
Overrides:
addAll in class AbstractShortList

addAll

public boolean addAll(int index,
                      ShortList l)
Description copied from class: AbstractShortList
Delegates to a more generic method.

Specified by:
addAll in interface ShortList
Overrides:
addAll in class AbstractShortList

getShort

public short getShort(int index)
Specified by:
getShort in interface ShortList
See Also:
List.get(int)

removeShort

public short removeShort(int index)
Specified by:
removeShort in interface ShortList
Overrides:
removeShort in class AbstractShortList

rem

public boolean rem(short k)
Description copied from interface: ShortCollection
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 ShortCollection
Overrides:
rem in class AbstractShortList

set

public short set(int index,
                 short k)
Specified by:
set in interface ShortList
Overrides:
set in class AbstractShortList

clear

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

size

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

getElements

public void getElements(int from,
                        short[] a,
                        int offset,
                        int length)
Description copied from class: AbstractShortList
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 optimized version.

Specified by:
getElements in interface ShortList
Overrides:
getElements in class AbstractShortList
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 class: AbstractShortList
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 optimized version.

Specified by:
removeElements in interface ShortList
Overrides:
removeElements in class AbstractShortList
Parameters:
from - the start index (inclusive).
to - the end index (exclusive).

addElements

public void addElements(int index,
                        short[] a,
                        int offset,
                        int length)
Description copied from class: AbstractShortList
Adds elements to 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 optimized version.

Specified by:
addElements in interface ShortList
Overrides:
addElements in class AbstractShortList
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.

shortListIterator

public ShortListIterator shortListIterator(int index)
Description copied from interface: ShortList
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:
shortListIterator in interface ShortList
Overrides:
shortListIterator in class AbstractShortList

shortSubList

public ShortList shortSubList(int from,
                              int to)
Specified by:
shortSubList in interface ShortList
Overrides:
shortSubList in class AbstractShortList