File tree Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Original file line number Diff line number Diff line change @@ -421,25 +421,6 @@ Future は同じ `Throwable` とともに失敗する。
421
421
422
422
anyQuote onSuccess { println(_) }
423
423
424
- ` either ` コンビネータはこの Futuere もしくは引数として渡された Future
425
- の結果を持つ新たな Future を作成する。これは結果が成功か失敗したかに関わらず先に完了した方の値が採用される。
426
- 以下は先に返ってきた為替レートを表示する具体例だ:
427
-
428
- val usdQuote = future {
429
- connection.getCurrentValue(USD)
430
- } map {
431
- usd => "値: " + usd + " USD"
432
- }
433
- val chfQuote = future {
434
- connection.getCurrentValue(CHF)
435
- } map {
436
- chf => "値: " + chf + "CHF"
437
- }
438
-
439
- val anyQuote = usdQuote either chfQuote
440
-
441
- anyQuote onSuccess { println(_) }
442
-
443
424
` andThen ` コンビネータは副作用の目的のためだけに用いられる。
444
425
これは、成功したか失敗したかに関わらず現在の Future と全く同一の結果を返す新たな Future を作成する。
445
426
現在の Future が完了すると、` andThen ` に渡されたクロージャが呼び出され、新たな Future
You can’t perform that action at this time.
0 commit comments