it.unimi.dsi.fastutil.ints
Class AbstractIntList.IntSubList

java.lang.Object
  extended by java.util.AbstractCollection<Integer>
      extended by it.unimi.dsi.fastutil.ints.AbstractIntCollection
          extended by it.unimi.dsi.fastutil.ints.AbstractIntList
              extended by it.unimi.dsi.fastutil.ints.AbstractIntList.IntSubList
All Implemented Interfaces:
IntCollection, IntIterable, IntList, IntStack, Stack<Integer>, Serializable, Comparable<List<? extends Integer>>, Iterable<Integer>, Collection<Integer>, List<Integer>
Enclosing class:
AbstractIntList

public static class AbstractIntList.IntSubList
extends AbstractIntList
implements Serializable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.ints.AbstractIntList
AbstractIntList.IntSubList
 
Field Summary
protected  int from
          Initial (inclusive) index of this sublist.
protected  IntList l
          The list this sublist restricts.
static long serialVersionUID
           
protected  int to
          Final (exclusive) index of this sublist.
 
Constructor Summary
AbstractIntList.IntSubList(IntList l, int from, int to)
           
 
Method Summary
 boolean add(int k)
           
 void add(int index, int k)
           
 boolean addAll(int index, Collection<? extends Integer> c)
           
 boolean addAll(int index, IntCollection c)
          Delegates to a more generic method.
 boolean addAll(int index, IntList l)
          Delegates to a more generic method.
 void addElements(int index, int[] a, int offset, int length)
          Adds elements to this type-specific list one-by-one.
 void clear()
           
 void getElements(int from, int[] a, int offset, int length)
          Copies element of this type-specific list into the given array one-by-one.
 int getInt(int index)
           
 IntListIterator listIterator(int index)
          Returns a type-specific list iterator on the list starting at a given index.
 boolean rem(int 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 remove(Object o)
          Delegates to rem().
 void removeElements(int from, int to)
          Removes elements of this type-specific list one-by-one.
 int removeInt(int index)
           
 int set(int index, int k)
           
 int size()
           
 IntList 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.
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntList
add, addAll, addAll, addAll, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, get, hashCode, indexOf, indexOf, intListIterator, intListIterator, intSubList, iterator, lastIndexOf, lastIndexOf, listIterator, peek, peekInt, pop, popInt, push, push, remove, set, size, top, topInt, toString
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntCollection
add, contains, containsAll, containsAll, intIterator, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toIntArray, toIntArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntCollection
containsAll, intIterator, removeAll, retainAll, toArray, toArray, toIntArray, toIntArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

l

protected final IntList l
The list this sublist restricts.


from

protected final int from
Initial (inclusive) index of this sublist.


to

protected int to
Final (exclusive) index of this sublist.

Constructor Detail

AbstractIntList.IntSubList

public AbstractIntList.IntSubList(IntList l,
                                  int from,
                                  int to)
Method Detail

add

public boolean add(int k)
Specified by:
add in interface IntCollection
Specified by:
add in interface IntList
Overrides:
add in class AbstractIntList
See Also:
Collection.add(Object)

add

public void add(int index,
                int k)
Specified by:
add in interface IntList
Overrides:
add in class AbstractIntList
See Also:
List.add(int,Object)

addAll

public boolean addAll(int index,
                      Collection<? extends Integer> c)
Specified by:
addAll in interface List<Integer>
Overrides:
addAll in class AbstractIntList

getInt

public int getInt(int index)
Specified by:
getInt in interface IntList
See Also:
List.get(int)

removeInt

public int removeInt(int index)
Specified by:
removeInt in interface IntList
Overrides:
removeInt in class AbstractIntList
See Also:
List.remove(int)

set

public int set(int index,
               int k)
Specified by:
set in interface IntList
Overrides:
set in class AbstractIntList
See Also:
List.set(int,Object)

clear

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

size

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

getElements

public void getElements(int from,
                        int[] a,
                        int offset,
                        int length)
Description copied from class: AbstractIntList
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 IntList
Overrides:
getElements in class AbstractIntList
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: AbstractIntList
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 IntList
Overrides:
removeElements in class AbstractIntList
Parameters:
from - the start index (inclusive).
to - the end index (exclusive).

addElements

public void addElements(int index,
                        int[] a,
                        int offset,
                        int length)
Description copied from class: AbstractIntList
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 IntList
Overrides:
addElements in class AbstractIntList
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.

listIterator

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

Specified by:
listIterator in interface IntList
Specified by:
listIterator in interface List<Integer>
Overrides:
listIterator in class AbstractIntList
See Also:
List.listIterator(int)

subList

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

rem

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

remove

public boolean remove(Object o)
Description copied from class: AbstractIntList
Delegates to rem().

Specified by:
remove in interface Collection<Integer>
Specified by:
remove in interface List<Integer>
Overrides:
remove in class AbstractIntList

addAll

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

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

addAll

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

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


Copyright © 2011. All Rights Reserved.