小编ruh*_*ewo的帖子

Java 8将字符串列表转换为映射列表

我有List<List<String>>。我想根据内部List的特定元素将其转换为Map。

我试过了

ddList.stream().flatMap(x -> x.stream()
            .collect(Collectors.toMap(Function.identity(), String::length)));
Run Code Online (Sandbox Code Playgroud)

它不起作用。这是怎么了?

java collections lambda java-8

-3
推荐指数
1
解决办法
72
查看次数

标签 统计

collections ×1

java ×1

java-8 ×1

lambda ×1