What changes need to be made for this code to print the string 12345? (Choose all that apply.)
Stream.iterate(1, x -> x++).limit(5).map(x -> x).collect(Collectors.joining());
joining()
to Collectors.joining("").collect()
.B, C, E.
As written, the code doesn't compile because the collector expects to get a String immediately before it in the chain.
Option B fixes this, at which point nothing is output because the collector creates a String.
Option E fixes this and causes the output to be 11111.
Since the post-increment operator is used, the stream contains an infinite number of 1s.
Option C fixes this and causes the stream to contain increasing numbers.