Expected behavior of a Streams.cycled() instance - found issues and questions

Peter Levart peter.levart at gmail.com
Wed Oct 24 04:50:08 PDT 2012


I wonder if the Streams.cycle(emptyStream) should return an empty stream 
instead of:

     public static<T> Stream<T> cycle(final Iterable<T> source) {

         // Check if the source is empty
         if (!source.iterator().hasNext()) {
             throw new IllegalArgumentException("Source Iterable to 
cycle elements from must not be empty");

Regards, Peter

More information about the lambda-dev mailing list