Java 流:有关收集到 Map<String、Object> 的问题
2022-09-04 02:06:26
我遇到了一个问题:
我已经创建了这个流,我需要映射到一个:Map<String, Object>
private Map<String, Object> collectArguments(JoinPoint point) {
CodeSignature signature = (CodeSignature) point.getSignature();
String[] argNames = signature.getParameterNames();
Object[] args = point.getArgs();
return IntStream.range(0, args.length)
.collect(Collectors.toMap(param -> argNames[param], param -> args[param]));
}
我收到以下消息,我不太清楚:
[Java] Type mismatch: cannot convert from Collector<Object,capture#3-of ?,Map<Object,Object>> to Supplier<R>