?????????????????????????????????′???parallel()?? sorted()???????????
????list.stream()
????.sorted()
????.parallel()
????.peek(list::remove)
????.forEach(System.out::println);
???????????? ??

????7
????6
????2
????5
????8
????4
????1
????0
????9
????3
?????????б????????
????[8]
?????????????????????е????????????????????????????????
??????Щ???????????????????????????????????????????????????????????????????????????
???????????????
??????????????????????????
????IntStream.range(1?? 5)
????.peek(System.out::println)
????.peek(i -> {
????if (i == 5)
????throw new RuntimeException("bang");
????});
??????????δ???????????????(1 2 3 4 5)???????????????????????????????????????????????????б????????????????????????
????????????API????DSL??????????????????????????????????????peek()??????????????????peek?е???????forEach()??
??????jOOQ???????????????????????????????? execute()????fetch():
????DSL.using(configuration)
????.update(TABLE)
????.set(TABLE.COL1?? 1)
????.set(TABLE.COL2?? "abc")
????.where(TABLE.ID.eq(3));
????????????????execute???????
??????????????
??????????????
???????????????????????????????е??????????????????????????е??????????????????????????????????????????????????????????????parallel()????????????????
????Object[] locks = { new Object()?? new Object() };
????IntStream
????.range(1?? 5)
????.parallel()
????.peek(Unchecked.intConsumer(i -> {
????synchronized (locks[i % locks.length]) {
????Thread.sleep(100);
????synchronized (locks[(i + 1) % locks.length]) {
????Thread.sleep(50);
????}
????}
????}))
????.forEach(System.out::println);
???????????Unchecked.intConsumer()??????????IntConsumer?????????? org.jooq.lambda.fi.util.function.CheckedIntConsumer???????????????????????
?????eɡ?????????????ù?????Щ?????????????:-)
??????????????????Java?????д?????????????????????????????????
????????????????????????Brian Goetz??StackOverflow?????????
????????
????????????????????????????????????????μ?????????BUG????ЩBUG?????????????????????????????衣??????????????????????????????????????
?????????????????????????????????????????????????