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

com.nitorcreations.willow.utils.EnumerationIterable Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show 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");
      }
    };
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy