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

com.day.util.IteratorEnumeration Maven / Gradle / Ivy

There is a newer version: 2024.11.18751.20241128T090041Z-241100
Show newest version
/*************************************************************************
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2020 Adobe
 *  All Rights Reserved.
 *
 * NOTICE: All information contained herein is, and remains
 * the property of Adobe and its suppliers, if any. The intellectual
 * and technical concepts contained herein are proprietary to Adobe
 * and its suppliers and are protected by all applicable intellectual
 * property laws, including trade secret and copyright laws.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe.
 **************************************************************************/
package com.day.util;

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

/**
 * An IteratorEnumeration provides a one-to-one mapping
 * from the pre Java 2 {@link java.util.Enumeration} to the Java 2
 * {@link java.util.Iterator}
 *
 * @version $Revision: 1.4 $
 * @author dpfister
 * @since antbear
 */
public class IteratorEnumeration implements Enumeration {

    /** Underlying iterator */
    protected Iterator iter;

    /**
     * Create a new IteratorEnumeration given an
     * {@link java.util.Iterator} that backs up the
     * {@link java.util.Enumeration}
     * @param iter the iterator
     */
    public IteratorEnumeration(Iterator iter) {
	this.iter = iter;
    }

    /**
     * Tests if this enumeration contains more elements.
     *
     * @return  true if and only if this enumeration object
     *           contains at least one more element to provide;
     *          false otherwise.
     */
    public boolean hasMoreElements() {
	return iter.hasNext();
    }

    /**
     * Returns the next element of this enumeration if this enumeration
     * object has at least one more element to provide.
     *
     * @return     the next element of this enumeration.
     */
    public Object nextElement() {
	return iter.next();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy