com.day.util.EnumerationIterator Maven / Gradle / Ivy
/**
* $Id: EnumerationIterator.java 12345 2004-08-22 04:56:09Z fielding $
*
* Copyright 1997-2004 Day Management AG
* Barfuesserplatz 6, 4001 Basel, Switzerland
* All Rights Reserved.
*
* This software is the confidential and proprietary information of
* Day Management AG, ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Day.
*/
package com.day.util;
import java.util.Enumeration;
import java.util.Iterator;
/**
* The EnumerationIterator
implements an Iterator
that
* iterates over a given Enumeration
. This is usefull, when needing
* an Iterator
but having an Enumeration
.
*
* @version $Revision: 1.7 $
* @author tripod
* @since antbear
* @audience wad
*/
public class EnumerationIterator implements Iterator {
/** the internal enumeratrion */
private final Enumeration delegatee;
/**
* Constructs an EnuerationIterator
* @param delegatee the underlaying enumeration
*/
public EnumerationIterator(Enumeration delegatee) {
this.delegatee = delegatee;
}
/**
* @see Iterator#hasNext()
*/
public boolean hasNext() {
return delegatee.hasMoreElements();
}
/**
* @see Iterator#next()
*/
public Object next() {
return delegatee.nextElement();
}
/**
* Always throws UnsupportedOperationException
.
*
* @see Iterator#remove()
*/
public void remove() {
throw new UnsupportedOperationException();
}
}