activemq-cpp-3.6.0
decaf::util::Iterator< E > Class Template Reference

Defines an object that can be used to iterate over the elements of a collection. More...

#include <src/main/decaf/util/Iterator.h>

Inheritance diagram for decaf::util::Iterator< E >:

Public Member Functions

virtual ~Iterator ()
virtual E next ()=0
 Returns the next element in the iteration.
virtual bool hasNext () const =0
 Returns true if the iteration has more elements.
virtual void remove ()=0
 Removes from the underlying collection the last element returned by the iterator (optional operation).

Detailed Description

template<typename E>
class decaf::util::Iterator< E >

Defines an object that can be used to iterate over the elements of a collection.

The iterator provides a way to access and remove elements with well defined semantics.

Constructor & Destructor Documentation

template<typename E>
virtual decaf::util::Iterator< E >::~Iterator ( )
inlinevirtual

Member Function Documentation

template<typename E>
virtual bool decaf::util::Iterator< E >::hasNext ( ) const
pure virtual

Returns true if the iteration has more elements.

Returns false if the next call to next would result in an NoSuchElementException to be thrown.

Returns
true if there are more elements available for iteration.

Implemented in decaf::util::concurrent::CopyOnWriteArrayList< E >::ArrayListIterator.

template<typename E>
virtual E decaf::util::Iterator< E >::next ( )
pure virtual

Returns the next element in the iteration.

Calling this method repeatedly until the hasNext() method returns false will return each element in the underlying collection exactly once.

Returns
the next element in the iteration of elements.
Exceptions
NoSuchElementExceptionif the iteration has no more elements.

Implemented in decaf::util::concurrent::CopyOnWriteArrayList< E >::ArrayListIterator.

template<typename E>
virtual void decaf::util::Iterator< E >::remove ( )
pure virtual

Removes from the underlying collection the last element returned by the iterator (optional operation).

This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.

Exceptions
UnsupportedOperationExceptionif the remove operation is not supported by this Iterator.
IllegalStateExceptionif the next method has not yet been called, or the remove method has already been called after the last call to the next method.

Implemented in decaf::util::concurrent::CopyOnWriteArrayList< E >::ArrayListIterator.


The documentation for this class was generated from the following file: