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

com.day.util.EnumerationIterator 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;

/**
 * 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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy