com.nitorcreations.willow.utils.EnumerationIterable Maven / Gradle / Ivy
The newest version!
package com.nitorcreations.willow.utils;
import java.util.Enumeration;
import java.util.Iterator;
public class EnumerationIterable implements Iterable {
private final Enumeration enumeration;
public EnumerationIterable(Enumeration enumeration) {
this.enumeration = enumeration;
}
@Override
public Iterator iterator() {
return new Iterator() {
@Override
public boolean hasNext() {
return enumeration.hasMoreElements();
}
@Override
public T next() {
return enumeration.nextElement();
}
@Override
public void remove() {
throw new UnsupportedOperationException("Remove not supported in underlying enumeration");
}
};
}
}