Class IteratorEnumeration<E>

    • Constructor Detail

      • IteratorEnumeration

        public IteratorEnumeration()
        Constructs a new IteratorEnumeration that will not function until setIterator is invoked.
      • IteratorEnumeration

        public IteratorEnumeration​(Iterator<? extends E> iterator)
        Constructs a new IteratorEnumeration that will use the given iterator.
        Parameters:
        iterator - the iterator to use
    • Method Detail

      • hasMoreElements

        public boolean hasMoreElements()
        Returns true if the underlying iterator has more elements.
        Specified by:
        hasMoreElements in interface Enumeration<E>
        Returns:
        true if the underlying iterator has more elements
      • nextElement

        public E nextElement()
        Returns the next element from the underlying iterator.
        Specified by:
        nextElement in interface Enumeration<E>
        Returns:
        the next element from the underlying iterator.
        Throws:
        NoSuchElementException - if the underlying iterator has no more elements
      • getIterator

        public Iterator<? extends E> getIterator()
        Returns the underlying iterator.
        Returns:
        the underlying iterator
      • setIterator

        public void setIterator​(Iterator<? extends E> iterator)
        Sets the underlying iterator.
        Parameters:
        iterator - the new underlying iterator