org.jqurantree.core.collections
Class ImmutableIteratorBase<T>

java.lang.Object
  extended by org.jqurantree.core.collections.ImmutableIteratorBase<T>
Type Parameters:
T - the type of element supported by this iterator
All Implemented Interfaces:
java.util.Iterator<T>
Direct Known Subclasses:
ArrayIterator

public abstract class ImmutableIteratorBase<T>
extends java.lang.Object
implements java.util.Iterator<T>

ImmutableIteratorBase provides a common implementation for iterators that do not modify their underlying collection.

Author:
Kais Dukes

Constructor Summary
ImmutableIteratorBase()
           
 
Method Summary
abstract  boolean hasNext()
          Returns true if the iteration has more elements.
abstract  T next()
          Returns the next element in the iteration.
 void remove()
          Always throws an UnsupportedOperationException, since the underlying collection is immutable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableIteratorBase

public ImmutableIteratorBase()
Method Detail

hasNext

public abstract boolean hasNext()
Returns true if the iteration has more elements.

Specified by:
hasNext in interface java.util.Iterator<T>
Returns:
true if the iterator has more elements.

next

public abstract T next()
Returns the next element in the iteration.

Specified by:
next in interface java.util.Iterator<T>
Returns:
the next element in the iteration.

remove

public void remove()
Always throws an UnsupportedOperationException, since the underlying collection is immutable

Specified by:
remove in interface java.util.Iterator<T>
Throws:
java.lang.UnsupportedOperationException - since the remove operation is not supported by this immutable iterator.


Copyright© Kais Dukes, 2009. All Rights Reserved.