????????л???Java 8??6?????
???????????? ???????[ 2014/7/15 11:21:35 ] ??????????????? java
????Java 8????????????????????????????????????????????????к??????????д???????????????У???????Java 8????????????????????Java 7??????8??????????????????Щ??
???????????????????
????Java 8???????????д??????????????????????????????????.parallelStream()?????????????????????????????????????????????????????????????????????CPU??????????????????????????Щ????????????fork/join?????????????????????????????????μ?????????????????????????????????????
?????????????????????????????????????????????????????????е?????????????????15%???????????п???????????????????????????????????????????????.parallelStream()??????????????????????С????????????????????????????????????????????л???????????????????
??????????????????????????????????????????????????????????????????????????
????Map<Boolean?? List<Integer>> groupByPrimary = numbers
????.parallelStream().collect(Collectors.groupingBy(s -> Utility.isPrime(s)));
???????б?????????????????????????????????????????????ж???????????????????????????????????????????????.parallelStream() ???з??????????????Щ???????????????????????Lukas Krecan????????£??????и?????Щ???????????
???????????д????????????????????????????????????????????????????????????????μ???????ū???????????????????????
????Lambda???????????
????Lambda????Lambda???????????????????????????????????????????????????????????????????????????????????????????????????????????????籭?????????????????????????
????List lengths = new ArrayList();
????for (String countries : Arrays.asList(args)) {
????lengths.add(check(country));
????}
???????????Lambda?????????ú???????
????Stream lengths = countries.stream().map(countries -> check(country));
??????????????????????????????£???????Lambda????????????????Java????????е????????????淶????????????????????????????????????????lambda???????????????????????????????????????Tal Weiss????????£??????????lambda???????Щ?????檔
??????????ζ??????д????????????????????????????????????????????????????????????????????
???????????????б?????????????????????????
????at LmbdaMain.check(LmbdaMain.java:19)
????at LmbdaMain.main(LmbdaMain.java:34)
?????????????
at LmbdaMain.check(LmbdaMain.java:19)
at LmbdaMain.lambda$0(LmbdaMain.java:37)
at LmbdaMain$$Lambda$1/821270929.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.LongPipeline.reduce(LongPipeline.java:438)
at java.util.stream.LongPipeline.sum(LongPipeline.java:396)
at java.util.stream.ReferencePipeline.count(ReferencePipeline.java:526)
at LmbdaMain.main(LmbdaMain.java:39)
|
????lambda?????????????????????????????lambda??????????????????????????????з??????????????????????ü???????????????μ??÷??????塣Lukas Eder??????????????????
??????????????????????????????????????????????赲???????lambda??????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11