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.O
get()
Access the current object.int
getOffset()
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 positionboolean
valid()
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:Iter
Returns true if the iterator currently points to a valid object.
-
advance
public ArrayListIter<O> advance()
Description copied from interface:Iter
Moves the iterator forward to the next entry.
-
getOffset
public int getOffset()
Description copied from interface:ArrayIter
Get current iterator offset.
-
advance
public ArrayListIter<O> advance(int count)
Description copied from interface:ArrayIter
Moves the iterator forward or backward by the given offset.
-
retract
public ArrayListIter<O> retract()
Description copied from interface:ArrayIter
Moves the iterator backward to the previous entry.
-
seek
public ArrayListIter<O> seek(int off)
Description copied from interface:ArrayIter
Moves the iterator to the given position
-
-