Creates an Enumeration out of the given Iterator. - Java java.util

Java examples for java.util:Enumeration

Description

Creates an Enumeration out of the given Iterator.

Demo Code


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

public class Main{
    public static void main(String[] argv){
        Iterator   it = java.util.Arrays.asList("asdf","java2s.com").iterator();
        System.out.println(createEnumerationFromIterator(it));
    }//from www . j  a  v  a2s  . c  o m
    /**
     * Creates an Enumeration out of the given Iterator.
     * @param <T>
     * @param it
     * @return an Enumeration created out of the given Iterator.
     */
    public static <T> Enumeration<T> createEnumerationFromIterator(
            Iterator<T> it) {
        return new IteratorEnumerationAdapter<T>(it);
    }
}

Related Tutorials