Class EnumerationIterator

  • All Implemented Interfaces:
    Iterator

    @Deprecated(since="2021-04-30")
    public class EnumerationIterator
    extends Object
    implements Iterator
    Deprecated.
    Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.
    Adapter to make Enumeration instances appear to be Iterator instances.
    Since:
    Commons Collections 1.0
    • Constructor Detail

      • EnumerationIterator

        public EnumerationIterator()
        Deprecated.
        Constructs a new EnumerationIterator that will not function until setEnumeration(Enumeration) is called.
      • EnumerationIterator

        public EnumerationIterator​(Enumeration enumeration)
        Deprecated.
        Constructs a new EnumerationIterator that provides an iterator view of the given enumeration.
        Parameters:
        enumeration - the enumeration to use
      • EnumerationIterator

        public EnumerationIterator​(Enumeration enumeration,
                                   Collection collection)
        Deprecated.
        Constructs a new EnumerationIterator that will remove elements from the specified collection.
        Parameters:
        enumeration - the enumeration to use
        collection - the collection to remove elements form
    • Method Detail

      • hasNext

        public boolean hasNext()
        Deprecated.
        Returns true if the underlying enumeration has more elements.
        Specified by:
        hasNext in interface Iterator
        Returns:
        true if the underlying enumeration has more elements
        Throws:
        NullPointerException - if the underlying enumeration is null
      • next

        public Object next()
        Deprecated.
        Returns the next object from the enumeration.
        Specified by:
        next in interface Iterator
        Returns:
        the next object from the enumeration
        Throws:
        NullPointerException - if the enumeration is null
      • remove

        public void remove()
        Deprecated.
        Removes the last retrieved element if a collection is attached.

        Functions if an associated Collection is known. If so, the first occurrence of the last returned object from this iterator will be removed from the collection.

        Specified by:
        remove in interface Iterator
        Throws:
        IllegalStateException - next() not called.
        UnsupportedOperationException - if no associated collection
      • getEnumeration

        public Enumeration getEnumeration()
        Deprecated.
        Returns the underlying enumeration.
        Returns:
        the underlying enumeration
      • setEnumeration

        public void setEnumeration​(Enumeration enumeration)
        Deprecated.
        Sets the underlying enumeration.
        Parameters:
        enumeration - the new underlying enumeration