Class AbstractEnumerationDecorator<E>
- java.lang.Object
-
- com.globalmentor.collections.iterators.AbstractEnumerationDecorator<E>
-
- Type Parameters:
E
- the type of elements returned by this enumeration.
- All Implemented Interfaces:
java.util.Enumeration<E>
,java.util.Iterator<E>
- Direct Known Subclasses:
EnumerationDecorator
public abstract class AbstractEnumerationDecorator<E> extends java.lang.Object implements java.util.Enumeration<E>, java.util.Iterator<E>
An abstract base implementation of an enumeration that wraps an existingEnumeration
.- Author:
- Garret Wilson
- API Note:
- This enumeration also serves as an adapter, converting an enumeration to an
Iterator
. - Implementation Specification:
- This implementation does not support element removal.
- Implementation Note:
- Subclasses may override
hasMoreElements()
and/ornextElement()
, andIterator
compatibility will be maintained.
-
-
Constructor Summary
Constructors Constructor Description AbstractEnumerationDecorator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.Enumeration<E>
getEnumeration()
boolean
hasMoreElements()
boolean
hasNext()
E
next()
E
nextElement()
void
remove()
-
-
-
Method Detail
-
getEnumeration
protected abstract java.util.Enumeration<E> getEnumeration()
- Returns:
- The enumeration this class decorates.
-
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElements
in interfacejava.util.Enumeration<E>
-
hasNext
public final boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<E>
- Implementation Specification:
- This implementation delegates to
hasMoreElements()
.
-
next
public final E next()
- Specified by:
next
in interfacejava.util.Iterator<E>
- Implementation Specification:
- This implementation delegates to
nextElement()
.
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<E>
- Implementation Specification:
- This implementation throws an
UnsupportedOperationException
.
-
-