diff --git a/ja/overviews/core/futures.md b/ja/overviews/core/futures.md index bf7432bac0..6ecaab4320 100644 --- a/ja/overviews/core/futures.md +++ b/ja/overviews/core/futures.md @@ -428,13 +428,13 @@ Future は同じ `Throwable` とともに失敗する。 ソーシャルネットワークからの最近の投稿文を可変セットに保存して、全ての投稿文を画面に表示する以下の具体例をみてみよう: val allposts = mutable.Set[String]() - + Future { session.getRecentPosts } andThen { - posts => allposts ++= posts + case Success(posts) => allposts ++= posts } andThen { - posts => + case _ => clearAll() for (post <- allposts) render(post) } diff --git a/overviews/core/_posts/2012-09-20-futures.md b/overviews/core/_posts/2012-09-20-futures.md index a0313df542..3d4dedf5ec 100644 --- a/overviews/core/_posts/2012-09-20-futures.md +++ b/overviews/core/_posts/2012-09-20-futures.md @@ -699,13 +699,13 @@ which stores the recent posts from a social network to a mutable set and then renders all the posts to the screen: val allposts = mutable.Set[String]() - + Future { session.getRecentPosts } andThen { - posts => allposts ++= posts + case Success(posts) => allposts ++= posts } andThen { - posts => + case _ => clearAll() for (post <- allposts) render(post) } diff --git a/sips/completed/_posts/2012-01-21-futures-promises.md b/sips/completed/_posts/2012-01-21-futures-promises.md index bbe61d0a7e..c502ddc1fe 100644 --- a/sips/completed/_posts/2012-01-21-futures-promises.md +++ b/sips/completed/_posts/2012-01-21-futures-promises.md @@ -386,13 +386,13 @@ which stores the recent posts from a social network to a mutable set and then renders all the posts to the screen: val allposts = mutable.Set[String]() - + Future { session.getRecentPosts } andThen { - posts => allposts ++= posts + case Success(posts) => allposts ++= posts } andThen { - posts => + case _ => clearAll() for (post <- allposts) render(post) } diff --git a/zh-cn/overviews/core/futures.md b/zh-cn/overviews/core/futures.md index 5c7a36f271..b3eb21271b 100644 --- a/zh-cn/overviews/core/futures.md +++ b/zh-cn/overviews/core/futures.md @@ -299,13 +299,13 @@ fallbackTo组合器生成的future对象可以在该原future成功完成计算 组合器andThen的用法是出于纯粹的side-effecting目的。经andThen返回的新Future无论原Future成功或失败都会返回与原Future一模一样的结果。一旦原Future完成并返回结果,andThen后跟的代码块就会被调用,且新Future将返回与原Future一样的结果,这确保了多个andThen调用的顺序执行。正如下例所示,这段代码可以从社交网站上把近期发出的帖子收集到一个可变集合里,然后把它们都打印在屏幕上: val allposts = mutable.Set[String]() - - future { + + Future { session.getRecentPosts } andThen { - posts => allposts ++= posts + case Success(posts) => allposts ++= posts } andThen { - posts => + case _ => clearAll() for (post <- allposts) render(post) }