Class IterableIt<O>

  • Type Parameters:
    O - contained object type.
    All Implemented Interfaces:
    It<O>, Iter

    public class IterableIt<O>
    extends java.lang.Object
    implements It<O>
    ELKI style Iterator wrapper for collections.

    Note: for collections implementing RandomAccess, always use ArrayListIter instead (less wrapping)!

    Since:
    0.7.5
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.Object cur
      Current object.
      private static java.lang.Object END_VALUE
      End sentinel value.
      (package private) java.util.Iterator<O> inner
      The proxied iterator.
    • Constructor Summary

      Constructors 
      Constructor Description
      IterableIt​(java.lang.Iterable<O> data)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      It<O> advance()
      Moves the iterator forward to the next entry.
      O get()
      Access the current object.
      boolean valid()
      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
    • Field Detail

      • inner

        final java.util.Iterator<O> inner
        The proxied iterator.
      • cur

        java.lang.Object cur
        Current object.
      • END_VALUE

        private static final java.lang.Object END_VALUE
        End sentinel value.
    • Constructor Detail

      • IterableIt

        public IterableIt​(java.lang.Iterable<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.
        Specified by:
        valid in interface Iter
        Returns:
        a boolean value, whether the position is valid.
      • advance

        public It<O> advance()
        Description copied from interface: Iter
        Moves the iterator forward to the next entry.
        Specified by:
        advance in interface It<O>
        Specified by:
        advance in interface Iter
        Returns:
        The iterator itself.
      • get

        public O get()
        Description copied from interface: It
        Access the current object.
        Specified by:
        get in interface It<O>
        Returns:
        Current object