Expected behavior of a Streams.cycled() instance - found issues and questions
Paul Sandoz
paul.sandoz at oracle.com
Wed Oct 24 04:59:34 PDT 2012
On Oct 24, 2012, at 1:50 PM, Peter Levart <peter.levart at gmail.com> wrote:
> Hi,
>
> I wonder if the Streams.cycle(emptyStream) should return an empty stream instead of:
>
> public static<T> Stream<T> cycle(final Iterable<T> source) {
> Objects.requireNonNull(source);
>
> // Check if the source is empty
> if (!source.iterator().hasNext()) {
> throw new IllegalArgumentException("Source Iterable to cycle elements from must not be empty");
> }
>
Yes, nice catch.
Paul.
More information about the lambda-dev
mailing list