Question 5
Method Stream.iterate(e, f) returns an infinite sequential ordered Stream produced by iterative application of a function f to an initial element e, producing a Stream consisting of e, f(e), f(f(e)), etc.
Based on the above information, consider the code given below, and answer the question that follows.
import java.util.stream.*;public class StreamTest { public static void main(String[] args) { Stream.iterate(5, n -> n + 3) .filter(n -> n % 4 == 0) .map(n -> n / 2) .limit(4) .forEach((x) -> System.out.print(x + " ")); }}What will the output be?
2 4 6 8
4 6 8 10
4 10 16 22
8 16 24 32