Package org.apache.pivot.util
Class ImmutableIterator<T>
- java.lang.Object
-
- org.apache.pivot.util.ImmutableIterator<T>
-
- Type Parameters:
T- The type of elements we are iterating over.
- All Implemented Interfaces:
java.util.Iterator<T>
public final class ImmutableIterator<T> extends java.lang.Object implements java.util.Iterator<T>Immutable implementation of theIteratorinterface.The only methods that have actual implementations (that just defer to the underlying
Iterator) are:hasNext()andnext().Note: the
remove()method implementation here has been taken out because there is now a default implementation in theIteratorinterface itself in Java 8.
-
-
Constructor Summary
Constructors Constructor Description ImmutableIterator(java.util.Iterator<T> iter)Construct an immutable iterator over the base iterator given here.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Tnext()
-
-
-
Constructor Detail
-
ImmutableIterator
public ImmutableIterator(java.util.Iterator<T> iter)
Construct an immutable iterator over the base iterator given here.- Parameters:
iter- The base iterator we want to protect from change.- Throws:
java.lang.IllegalArgumentException- if the iterator isnull.
-
-