All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.biz.utils.EnumerationIterator Maven / Gradle / Ivy

There is a newer version: 1.0.7.RELEASE
Show newest version
package org.springframework.biz.utils;

import java.util.Iterator;
import java.util.Enumeration;

/**
 * An Iterator wrapper for an Enumeration.
 */
public class EnumerationIterator implements Iterator {
	/**
	 * The enumeration to iterate.
	 */
	private Enumeration enumeration = null;

	/**
	 * Creates a new iteratorwrapper instance for the specified Enumeration.
	 *
	 * @param enumeration
	 *            The Enumeration to wrap.
	 */
	public EnumerationIterator(Enumeration enumeration) {
		this.enumeration = enumeration;
	}

	/**
	 * Move to next element in the array.
	 *
	 * @return The next object in the array.
	 */
	public T next() {
		return enumeration.nextElement();
	}

	/**
	 * Check to see if there is another element in the array.
	 *
	 * @return Whether there is another element.
	 */
	public boolean hasNext() {
		return enumeration.hasMoreElements();
	}

	/**
	 * Unimplemented. No analogy in Enumeration
	 */
	public void remove() {
		// not implemented
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy