"The limit()
and skip()
methods make a Stream
smaller. They could make a finite stream smaller, or they could make a finite stream out of an infinite stream. The method signatures are shown here:
Stream<T> limit(int maxSize)
Stream<T> skip(int n)
The following code c...."
The above is an excerpt from OCP java 8 book. When it said "could make a finite stream out of an infinite stream", did they mean it in both the methods together or alone? I can imagine how limit()
would make an infinite stream smaller, but how skip()
alone would accomplish that? Is there a way or the wording in the documentation needs to be clearer?