up: I     index Zimbu documentation

INTERFACE I.Iterator<Titem> @public

summary

     

The interface that all iterators must implement.

Sketch of how this is used:

  I.Iterator it = foo.Iterator()
  IF it.hasNext() && it.peekSupported()
    IO.print("First item: " .. it.peek().ToString())
  }
  FOR item IN it
    IO.print("Item: " .. item.ToString())
  }

$hasNext() bool @public  Returns TRUE when there is another item to fetch.
$next() Titem @public  Returns the next item and advances.
$peekSupported() bool @public  Returns TRUE when peek() is supported.
$peek() Titem @public  Returns the next item without advancing.
 
Known subclasses:
     
 

members (alphabetically)

     

FUNC $hasNext() bool @abstract @public

     

Returns TRUE when there is another item to fetch.

FUNC $next() Titem @abstract @public

     

Returns the next item and advances.

When there is no next item it throws an E.OutOfRange exception.

FUNC $peek() Titem @abstract @public

     

Returns the next item without advancing.

When there is no next item it throws an E.OutOfRange exception. First use hasNext() to check.

This is an optional method, when peeking is not possible it throws an E.Unsupported exception.

FUNC $peekSupported() bool @abstract @public

     

Returns TRUE when peek() is supported.

license

      Copyright 2013 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0