Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

Iterator Class Reference

#include <coherence/util/Iterator.hpp>

Inherits Object.

Inherited by EndIterator [virtual], ListIterator [virtual], and Muterator [virtual].

List of all members.


Detailed Description

An object that implements the Iterator interface generates series of Object::Holders, one at a time.

Successive calls to next() return successive elements of the series.

For example, to print all elements of a collection hCol:

 for (Iterator::Handle hIter = hCol->iterator(); hIter->hasNext(); )
     {
     std::cout << hIter->next() << std::endl;
     }
 
See also:
Collection
Author:
jh/mf/nsa 2008.01.28

Public Types

typedef spec::Handle  Handle
  Iterator Handle definition.
typedef spec::View  View
  Iterator View definition.
typedef spec::Holder  Holder
  Iterator Holder definition.

Public Member Functions

virtual bool  hasNext () const =0
  Determine if the iteration has another element.
virtual Object::Holder  next ()=0
  Return the next element in the iterated series.

Member Function Documentation

virtual bool hasNext (  )  const [pure virtual]

Determine if the iteration has another element.

Returns:
true if the iterator has another element

Implemented in AbstractStableIterator, FilterMuterator, WrapperCollections::AbstractWrapperIterator, and WrapperCollections::AbstractWrapperListIterator.

virtual Object::Holder next (  )  [pure virtual]

Return the next element in the iterated series.

Returns:
the next element in the iterated series
Exceptions:
coherence::lang::NoSuchElementException  if iteration has no more elements

Implemented in AbstractStableIterator, ConverterCollections::ConverterIterator, FilterMuterator, WrapperCollections::AbstractWrapperIterator, and WrapperCollections::AbstractWrapperListIterator.


The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.