Class ArrayListIter<O>
- java.lang.Object
-
- elki.utilities.datastructures.iterator.ArrayListIter<O>
-
- Type Parameters:
O- contained object type.
public class ArrayListIter<O> extends java.lang.Object implements ArrayIter, It<O>
ELKI style Iterator for array lists.Note: this implementation is only efficient for lists with efficient random access and seeking (i.e. ArrayLists, but not Linked Lists!)
- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Constructor Description ArrayListIter(java.util.List<O> data)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayListIter<O>advance()Moves the iterator forward to the next entry.ArrayListIter<O>advance(int count)Moves the iterator forward or backward by the given offset.Oget()Access the current object.intgetOffset()Get current iterator offset.ArrayListIter<O>retract()Moves the iterator backward to the previous entry.ArrayListIter<O>seek(int off)Moves the iterator to the given positionbooleanvalid()Returns true if the iterator currently points to a valid object.
-
-
-
Field Detail
-
data
final java.util.List<O> data
The array list to iterate over.
-
pos
int pos
Current position.
-
-
Constructor Detail
-
ArrayListIter
public ArrayListIter(java.util.List<O> data)
Constructor.- Parameters:
data- Data array.
-
-
Method Detail
-
valid
public boolean valid()
Description copied from interface:IterReturns true if the iterator currently points to a valid object.
-
advance
public ArrayListIter<O> advance()
Description copied from interface:IterMoves the iterator forward to the next entry.
-
getOffset
public int getOffset()
Description copied from interface:ArrayIterGet current iterator offset.
-
advance
public ArrayListIter<O> advance(int count)
Description copied from interface:ArrayIterMoves the iterator forward or backward by the given offset.
-
retract
public ArrayListIter<O> retract()
Description copied from interface:ArrayIterMoves the iterator backward to the previous entry.
-
seek
public ArrayListIter<O> seek(int off)
Description copied from interface:ArrayIterMoves the iterator to the given position
-
-