The limit of the elements is specified via the Stream.limit() function. Limit(X) will return a stream with the size you specified, where X is the value you entered. It belongs to the class java.util.stream.Stream.