org.apache.pluto.util
Class Enumerator

java.lang.Object
  extended by org.apache.pluto.util.Enumerator
All Implemented Interfaces:
Enumeration

public final class Enumerator
extends Object
implements Enumeration

Uitlity class to wraps an Enumeration around a Collection, i.e. Iterator classes.


Constructor Summary
Enumerator(Collection collection)
          Returns an Enumeration over the specified Collection.
Enumerator(Iterator iterator)
          Returns an Enumeration over the values of the specified Iterator.
Enumerator(Map map)
          Returns an Enumeration over the values of the specified Map.
 
Method Summary
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 Object nextElement()
          Returns the next element of this enumeration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Enumerator

public Enumerator(Collection collection)
Returns an Enumeration over the specified Collection.

Parameters:
collection - Collection with values that should be enumerated

Enumerator

public Enumerator(Iterator iterator)
Returns an Enumeration over the values of the specified Iterator.

Parameters:
iterator - Iterator to be wrapped

Enumerator

public Enumerator(Map map)
Returns an Enumeration over the values of the specified Map.

Parameters:
map - Map with values that should be enumerated
Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.

Specified by:
hasMoreElements in interface Enumeration
Returns:
true if this enumeration contains at least one more element to provide, false otherwise.

nextElement

public Object nextElement()
                   throws NoSuchElementException
Returns the next element of this enumeration.

Specified by:
nextElement in interface Enumeration
Returns:
the next element of this enumeration
Throws:
NoSuchElementException - if no more elements exist


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.