com.myarch.treeiterator
Class EnumerationAdapter

java.lang.Object
  |
  +--com.myarch.treeiterator.EnumerationAdapter
All Implemented Interfaces:
java.util.Iterator

public class EnumerationAdapter
extends java.lang.Object
implements java.util.Iterator

Implements java.util.Iterator interface for Enumeration. Useful when java.util.Iterator interface is not supported directly.


Constructor Summary
EnumerationAdapter(java.util.Enumeration enum)
          Adapter constructor.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Object next()
          Returns the next element in the interation.
 void remove()
          This method is defined to comply with Iterator but it is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationAdapter

public EnumerationAdapter(java.util.Enumeration enum)
Adapter constructor.
Parameters:
enum - any object implementing Enumeration
Method Detail

next

public java.lang.Object next()
Returns the next element in the interation.
Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration
Throws:
NoSuchElementException - if no more elements exist.

hasNext

public boolean hasNext()
Returns true if the iteration has more elements.
Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements.

remove

public void remove()
            throws java.lang.UnsupportedOperationException
This method is defined to comply with Iterator but it is not supported.
Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - whenever it is called


Copyright © 2001 Alexander Ananiev & MyArch.com. All Rights Reserved.