【发布时间】:2022-10-22 09:04:09
【问题描述】:
我想问如何在 Groovy 中编写以下代码。
List < String > nums = ['a','b']
Map<String, Long> counts = nums.parallelStream()
.collect( Collectors.groupingBy(k -> k.toLowerCase(),
Collectors.counting()) );
Output in java: {a:1,b:1}
I tried using the same but it gives error below:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/cg/root/492337/main.groovy: 7: unexpected token: -> @ line 7, column 43.
lect( Collectors.groupingBy(k -\> k.toLow
【问题讨论】:
标签: java dictionary groovy stream