鉴于此 java 8 代码
public Server send(String message) {
sessions.parallelStream()
.map(Session::getBasicRemote)
.forEach(basic -> {
try {
basic.sendText(message);
} catch (IOException e) {
e.printStackTrace();
}
});
return this;
}
我们如何正确地将IOException
其委托给方法调用的堆栈?(简而言之,如何让这个方法抛出这个IOException
?)
java中的Lambdas看起来对错误处理不是很友好......