Here you can find the source of enumerationAsStream(Enumeration
public static <T> Stream<T> enumerationAsStream(Enumeration<T> e)
//package com.java2s; //License from project: Open Source License import java.util.Enumeration; import java.util.Iterator; import java.util.Spliterator; import java.util.Spliterators; import java.util.stream.Stream; import java.util.stream.StreamSupport; public class Main { public static <T> Stream<T> enumerationAsStream(Enumeration<T> e) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<T>() { public T next() { return e.nextElement(); }/*from www.java 2s .com*/ public boolean hasNext() { return e.hasMoreElements(); } }, Spliterator.ORDERED), false); } }