上面你给的方案并没有解决错误 请重新修正
时间: 2024-02-26 07:56:39 浏览: 20
抱歉,我没有看到你使用的是 `Map.Entry`。在这种情况下,你可以将 `Map.Entry` 显式地指定为类型参数,例如:
```
Map<String, Map<String, List<String>>> tag2AllFunds = Maps.newHashMap();
Comparator<String> comparator = Collator.getInstance(Locale.CHINA);
tag2AllFunds.forEach((key, value) -> {
value.entrySet().stream()
.sorted(Comparator.comparing((Map.Entry<String, List<String>> entry) -> entry.getValue().size())
.reversed()
.thenComparing(entry -> entry.getKey(), comparator))
.collect(Collectors.toMap(
(Map.Entry<String, List<String>> entry) -> entry.getKey(),
(Map.Entry<String, List<String>> entry) -> entry.getValue(),
(v1, v2) -> v1,
LinkedHashMap::new
));
});
```
在 `Collectors.toMap` 中,我们将 `entry.getKey()` 和 `entry.getValue()` 分别替换为 `(Map.Entry<String, List<String>> entry) -> entry.getKey()` 和 `(Map.Entry<String, List<String>> entry) -> entry.getValue()`,以显示地指定类型参数。