Package com.iizix
Class EnumeratorFromIterator<T>
java.lang.Object
com.iizix.EnumeratorFromIterator<T>
- Type Parameters:
- T- The object type.
- All Implemented Interfaces:
- Enumeration<T>
Class that converts an Iterator to Enumerator interface, i.e. an enumeration over a collection.
- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- EnumeratorFromIterator- (Iterator<T> iterator) Constructs the Enumeration implementing class from an Iterator.
- Method SummaryModifier and TypeMethodDescription- static Enumeration- <?> - createEnumerator- (Iterator<?> iterator) Creates an instance of the Enumeration interface from an Iterator.- booleanReturns true if the enumeration has more elements.Returns the next element in the enumeration.- Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait- Methods inherited from interface java.util.Enumeration- asIterator
- Constructor Details- EnumeratorFromIteratorConstructs the Enumeration implementing class from an Iterator.- Parameters:
- iterator- The Iterator instance.
 
 
- Method Details- createEnumeratorCreates an instance of the Enumeration interface from an Iterator.- Parameters:
- iterator- The Iterator instance.
- Returns:
- A new Enumeration instance.
 
- hasMoreElementspublic 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- Enumeration<T>
- Returns:
- true if the enumerator has more elements.
 
- nextElementReturns the next element in the enumeration.- Specified by:
- nextElementin interface- Enumeration<T>