<分区>
无法将流对象包装在 try/catch block
中。
我试过这样的:
reponseNodes.stream().parallel().collect(Collectors.toMap(responseNode -> responseNode.getLabel(), responseNode -> processImage(responseNode)));
Eclipse 开始提示在 processImage(responseNode)
下划线,并建议它需要 Surround with try/catch
。
然后我更新为:
return reponseNodes.stream().parallel().collect(Collectors.toMap(responseNode -> responseNode.getLabel(), responseNode -> try { processImage(responseNode) } catch (Exception e) { throw new UncheckedException(e); }));
更新后的代码也不起作用。