I have gone through related questions like How to ensure order of processing in java8 streams?, still ordering of output element is not completely clear to me. Therefore please clarify my following doubt.
Integer[] intArray = {1, 2, 3, 4, 5, 6, 7, 8 };
List<Integer> listOfIntegers =
new ArrayList<>(Arrays.asList(intArray));
listOfIntegers
.parallelStream()
.unordered()
.forEachOrdered(e -> System.out.print(e + " "));
I think at least theoretically(or according to java specification) it can print in random order than 1, 2, 3, 4, 5, 6, 7, 8. Am I correct?
One more related question- the decision of the encounter order preservation is taken at what point of execution? To be more precise - is the evaluation of the entire stream pipeline ORDER characteristic done by going through the characteristics of source, intermediate operations and terminal operation even before the start of the execution?