我正在尝试将JsonNodes列表转换为fieldNames列表。
这就是我拼凑的东西:
final ResponseBody<JsonNode> body = state.getResponse().getBody();
final List<JsonNode> actualEntryList = body.jsonPath().getList('path.to.something');
final List<String> actualKeyList = actualEntryList.stream()
.flatMap(node -> // flatmap needs to return a stream
StreamSupport.stream(node.fieldNames(), false) // fieldNames return an iterator
).collect(Collectors.toList());
但是我收到错误Cannot infer type argument(s) for <R> flatMap(Function<? super T, ? extends Stream<? extends R>>)
,这让我觉得我做错了吗?
我应该如何进行转换?