Top Description Fields Constructors Methods
org.glassfish.grizzly.http.server.util

public final Class Enumerator<E>

extends Object
implements Enumeration<E>
Class Inheritance
All Implemented Interfaces
java.util.Enumeration
Imports
java.util.ArrayList, .Collection, .Enumeration, .Iterator, .List, .Map, .NoSuchElementException

HttpHandler class that wraps an Enumeration around a Java2 collection classes object Iterator so that existing APIs returning Enumerations can easily run on top of the new collections. Constructors are provided to easily create such wrappers.
Author
Craig R. McClanahan
Version
$Revision: 1.3 $ $Date: 2007/06/18 14:17:08 $

Field Summary

Modifier and TypeField and Description
private Iterator<E>
iterator

The Iterator over which the Enumeration represented by this class actually operates.

Constructor Summary

AccessConstructor and Description
public
Enumerator(Collection<E>
Collection whose values should be enumerated
collection
)

Return an Enumeration over the values of the specified Collection.

public
Enumerator(Collection<E>
Collection whose values should be enumerated
collection
,
boolean
true to clone iterator
clone
)

Return an Enumeration over the values of the specified Collection.

public
Enumerator(Iterable<E>
Iterable to be wrapped
iterable
)

Return an Enumeration over the values returned by the specified Iterable.

public
Enumerator(Iterable<E>
Iterable to be wrapped
iterable
,
boolean
true to clone iterator
clone
)

Return an Enumeration over the values returned by the specified Iterable.

public
Enumerator(Iterator<E>
Iterator to be wrapped
iterator
)

Return an Enumeration over the values returned by the specified Iterator.

public
Enumerator(Iterator<E>
Iterator to be wrapped
iterator
,
boolean
true to clone iterator
clone
)

Return an Enumeration over the values returned by the specified Iterator.

public
Enumerator(Map<?, E>
Map whose values should be enumerated
map
)

Return an Enumeration over the values of the specified Map.

public
Enumerator(Map<?, E>
Map whose values should be enumerated
map
,
boolean
true to clone iterator
clone
)

Return an Enumeration over the values of the specified Map.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if and only if this enumeration object contains at least one more element to provide, false otherwise
hasMoreElements
()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

public E

Returns:

the next element of this enumeration
nextElement
()

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration has at least one more element to provide.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iteratorback to summary
private Iterator<E> iterator

The Iterator over which the Enumeration represented by this class actually operates.

Constructor Detail

Enumeratorback to summary
public Enumerator(Collection<E> collection)

Return an Enumeration over the values of the specified Collection.

Parameters
collection:Collection<E>

Collection whose values should be enumerated

Enumeratorback to summary
public Enumerator(Collection<E> collection, boolean clone)

Return an Enumeration over the values of the specified Collection.

Parameters
collection:Collection<E>

Collection whose values should be enumerated

clone:boolean

true to clone iterator

Enumeratorback to summary
public Enumerator(Iterable<E> iterable)

Return an Enumeration over the values returned by the specified Iterable.

Parameters
iterable:Iterable<E>

Iterable to be wrapped

Enumeratorback to summary
public Enumerator(Iterable<E> iterable, boolean clone)

Return an Enumeration over the values returned by the specified Iterable.

Parameters
iterable:Iterable<E>

Iterable to be wrapped

clone:boolean

true to clone iterator

Enumeratorback to summary
public Enumerator(Iterator<E> iterator)

Return an Enumeration over the values returned by the specified Iterator.

Parameters
iterator:Iterator<E>

Iterator to be wrapped

Enumeratorback to summary
public Enumerator(Iterator<E> iterator, boolean clone)

Return an Enumeration over the values returned by the specified Iterator.

Parameters
iterator:Iterator<E>

Iterator to be wrapped

clone:boolean

true to clone iterator

Enumeratorback to summary
public Enumerator(Map<?, E> map)

Return an Enumeration over the values of the specified Map.

Parameters
map:Map<?, E>

Map whose values should be enumerated

Enumeratorback to summary
public Enumerator(Map<?, E> map, boolean clone)

Return an Enumeration over the values of the specified Map.

Parameters
map:Map<?, E>

Map whose values should be enumerated

clone:boolean

true to clone iterator

Method Detail

hasMoreElementsback to summary
public boolean hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

Returns:boolean

true if and only if this enumeration object contains at least one more element to provide, false otherwise

Annotations
@Override
nextElementback to summary
public E nextElement() throws NoSuchElementException

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration has at least one more element to provide.

Returns:E

the next element of this enumeration

Annotations
@Override
Exceptions
NoSuchElementException:
if no more elements exist