Java examples for Collection Framework:Iterator
iterator As Enumeration
// Licensed to the Apache Software Foundation (ASF) under one //package com.java2s; import java.util.Enumeration; import java.util.Iterator; public class Main { public static <T> Enumeration<T> iteratorAsEnumeration( final Iterator<T> it) { return new Enumeration<T>() { public boolean hasMoreElements() { return it.hasNext(); }/*w w w .j a v a2s . c o m*/ public T nextElement() { return it.next(); } }; } }