Class 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 existing Enumeration.
    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/or nextElement(), and Iterator compatibility will be maintained.
    • Constructor Detail

      • AbstractEnumerationDecorator

        public AbstractEnumerationDecorator()
    • Method Detail

      • getEnumeration

        protected abstract java.util.Enumeration<E> getEnumeration()
        Returns:
        The enumeration this class decorates.
      • hasMoreElements

        public boolean hasMoreElements()
        Specified by:
        hasMoreElements in interface java.util.Enumeration<E>
      • nextElement

        public E nextElement()
        Specified by:
        nextElement in interface java.util.Enumeration<E>
      • hasNext

        public final boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<E>
        Implementation Specification:
        This implementation delegates to hasMoreElements().
      • next

        public final E next()
        Specified by:
        next in interface java.util.Iterator<E>
        Implementation Specification:
        This implementation delegates to nextElement().
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<E>
        Implementation Specification:
        This implementation throws an UnsupportedOperationException.