up: I     index Zimbu documentation

INTERFACE I.KeyIterator<Tkey, Titem> @public

summary

     

The interface for an iterator that provides access to its current position.

Sketch of how this is used:

  I.KeyIterator kit = foo.KeyIterator()
  IF kit.hasNext() && kit.peekSupported()
    KeyType key, ItemType item = kit.peek()
    IO.print("First item[" .. key.ToString() .. "]: " .. item.ToString())
  }
  FOR key, item IN kit
    IO.print("Item[" .. key.ToString() .. "]: " .. item.ToString())
  }

$hasNext() bool @public  Returns TRUE when there is another item to fetch.
$next() Tkey, Titem @public  Returns the next key/item and advances.
$peekSupported() bool @public  Returns TRUE when peek() is supported.
$peek() Tkey, Titem @public  Returns the next key/item without advancing.
 

members (alphabetically)

     

FUNC $hasNext() bool @abstract @public

     

Returns TRUE when there is another item to fetch.

FUNC $next() Tkey, Titem @abstract @public

     

Returns the next key/item and advances.

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

FUNC $peek() Tkey, Titem @abstract @public

     

Returns the next key/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