Package com.iizix
Class EnumeratorFromIterator<T>
- java.lang.Object
- com.iizix.EnumeratorFromIterator<T>
 
- Type Parameters:
- T- The object type.
 - All Implemented Interfaces:
- java.util.Enumeration<T>
 - public class EnumeratorFromIterator<T> extends java.lang.Object implements java.util.Enumeration<T>Class that converts an Iterator to Enumerator interface, i.e. an enumeration over a collection.- Author:
- Christopher Mindus
 
- Constructor Summary- Constructors - Constructor - Description - EnumeratorFromIterator(java.util.Iterator<T> iterator)Constructs the Enumeration implementing class from an Iterator.
 - Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - static java.util.Enumeration<?>- createEnumerator(java.util.Iterator<?> iterator)Creates an instance of the Enumeration interface from an Iterator.- boolean- hasMoreElements()Returns true if the enumeration has more elements.- T- nextElement()Returns the next element in the enumeration.
 
- Constructor Detail- EnumeratorFromIterator- public EnumeratorFromIterator(java.util.Iterator<T> iterator) Constructs the Enumeration implementing class from an Iterator.- Parameters:
- iterator- The Iterator instance.
 
 
 - Method Detail- createEnumerator- public static java.util.Enumeration<?> createEnumerator(java.util.Iterator<?> iterator) Creates an instance of the Enumeration interface from an Iterator.- Parameters:
- iterator- The Iterator instance.
- Returns:
- A new Enumeration instance.
 
 - hasMoreElements- public boolean hasMoreElements() Returns true if the enumeration has more elements. (In other words, returns true if nextElement would return an element rather than throwing an exception.)- Specified by:
- hasMoreElementsin interface- java.util.Enumeration<T>
- Returns:
- true if the enumerator has more elements.