All Known Subinterfaces:
ArrayIter
All Known Implementing Classes:
ArrayListIter

public interface Iter
Iterator interface for more than one return value. The Java standard Iterator interface has some drawbacks:
  • the only way to get the current value is to advance the iterator
  • the iterator can only point to a single value
  • the iterator can only return objects, not primitives
This iterator interface is a bit more flexible. For example on a distance list, we can have a single type of iterator that allows access to the distance, the object ID or the combination of both. In some situations, this can save the creation of many small objects, which put load on the garbage collector. This super interface does not have a "get" operation, which is to come from specialized interfaces instead. Usage example:
 
 for (Iter iter = ids.iter(); iter.valid(); iter.advance()) {
   iter.doSomething();
 }
 
 
Author:
Erich Schubert
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Moves the iterator forward to the next entry.
    boolean
    Returns true if the iterator currently points to a valid object.
  • Method Details

    • valid

      boolean valid()
      Returns true if the iterator currently points to a valid object.
      Returns:
      a boolean value, whether the position is valid.
    • advance

      void advance()
      Moves the iterator forward to the next entry.