Package io.microsphere.collection
Class ReadOnlyIterator<E>
- java.lang.Object
-
- io.microsphere.collection.ReadOnlyIterator<E>
-
- Type Parameters:
E
- the type of elements returned by this iterator
- All Implemented Interfaces:
java.util.Iterator<E>
- Direct Known Subclasses:
EnumerationIteratorAdapter
,SingletonIterator
,UnmodifiableIterator
@Immutable public abstract class ReadOnlyIterator<E> extends java.lang.Object implements java.util.Iterator<E>
A skeletal implementation of theIterator
interface, designed to support read-only iteration. This class provides a default implementation for theremove()
method, which throws anIllegalStateException
, indicating that removal is not supported.Example Usage
{@code public class MyReadOnlyIterator extends ReadOnlyIterator
{ private String[] data = {"apple", "banana", "cherry"}; private int index = 0;
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
remove()
-
-
-
Method Detail
-
remove
public final void remove()
- Specified by:
remove
in interfacejava.util.Iterator<E>
-
-