【发布时间】:2016-03-10 22:30:31
【问题描述】:
无法将流对象包装在 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); }));
更新的代码也不起作用。
【问题讨论】:
-
您能输入 Eclipse 给您的确切警告/错误吗?
-
Eclipse 警告
Surround with try/catch下划线processImage(responseNode)。