forEachOrdered's semantic
Tristan Yan
tristan.yan at oracle.com
Fri Jun 14 09:33:28 PDT 2013
>From other thread and spec Stream.forEachOrdered() should behave like an order iteration but latest code shows it is not sorted. Below code shows result as
10 9 3 2 7 4 6 1 5 8
This is the same output as forEach, is there anything wrong?
List<Integer> oneToTen = IntStream.range(1, 11).boxed()
.collect(Collectors.<Integer>toList());
Collections.shuffle(oneToTen);
oneToTen.stream().forEachOrdered(t -> {
System.out.print(t);
System.out.print(" ");
});
Tristan Yan(Haibo Yan)
Office : 8610-61066212
Fax : 8610-61065441
Cell : 86-18610696822
2F, Building No. 24, Zhongguancun Software Park
Haidian District HYPERLINK "http://people.us.oracle.com/pls/oracle/f?p=8000:6:396067987304343:::6:P6_CITY:Beijing"Beijing , 100193
oracle
More information about the lambda-dev
mailing list