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

com.rabbitmq.jms.util.IteratorEnum Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
/* Copyright (c) 2013-2023 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. */
package com.rabbitmq.jms.util;

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

/**
 * An implementation of {@link Enumeration} that uses an {@link Iterator}.
 *
 * @param  type of elements enumerated
 */
public class IteratorEnum implements Enumeration {

    final Iterator it;

    /**
     * Create an enumeration based upon the supplied iterator. The iterator is not reset.
     *
     * @param it iterator to use for enumeration
     */
    public IteratorEnum(Iterator it) {
        this.it = it;
    }

    public boolean hasMoreElements() {
        return this.it.hasNext();
    }

    public E nextElement() {
        return this.it.next();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy