Module math

Class ArrayListIter<O>

java.lang.Object
de.lmu.ifi.dbs.elki.utilities.datastructures.iterator.ArrayListIter<O>
Type Parameters:
O - contained object type.
All Implemented Interfaces:
ArrayIter, Iter

public class ArrayListIter<O> extends Object implements ArrayIter
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!)
Author:
Erich Schubert
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Moves the iterator forward to the next entry.
    void
    advance(int count)
    Moves the iterator forward or backward by the given offset.
    get()
    Get the current element.
    int
    Get current iterator offset.
    void
    Moves the iterator backward to the previous entry.
    void
    seek(int off)
    Moves the iterator to the given position
    boolean
    Returns true if the iterator currently points to a valid object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArrayListIter

      public ArrayListIter(List<O> data)
      Constructor.
      Parameters:
      data - Data array.
  • Method Details

    • valid

      public boolean valid()
      Description copied from interface: Iter
      Returns true if the iterator currently points to a valid object.
      Specified by:
      valid in interface Iter
      Returns:
      a boolean value, whether the position is valid.
    • advance

      public void advance()
      Description copied from interface: Iter
      Moves the iterator forward to the next entry.
      Specified by:
      advance in interface Iter
    • getOffset

      public int getOffset()
      Description copied from interface: ArrayIter
      Get current iterator offset.
      Specified by:
      getOffset in interface ArrayIter
      Returns:
      Iterator position
    • advance

      public void advance(int count)
      Description copied from interface: ArrayIter
      Moves the iterator forward or backward by the given offset.
      Specified by:
      advance in interface ArrayIter
      Parameters:
      count - offset to move forward or backwards
    • retract

      public void retract()
      Description copied from interface: ArrayIter
      Moves the iterator backward to the previous entry.
      Specified by:
      retract in interface ArrayIter
    • seek

      public void seek(int off)
      Description copied from interface: ArrayIter
      Moves the iterator to the given position
      Specified by:
      seek in interface ArrayIter
      Parameters:
      off - Seek offset
    • get

      public O get()
      Get the current element.
      Returns:
      current element