Skip to content

Commit 57b91c5

Browse files
committed
Merge pull request scala#1656 from jsuereth/fix/remove-future-either-method
Removing controversial `either` method from Futures API.
2 parents aef7912 + ea72460 commit 57b91c5

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/library/scala/concurrent/Future.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -522,29 +522,6 @@ trait Future[+T] extends Awaitable[T] {
522522
p.future
523523
}
524524

525-
/** Creates a new future which holds the result of either this future or `that` future, depending on
526-
* which future was completed first.
527-
*
528-
* $nonDeterministic
529-
*
530-
* Example:
531-
* {{{
532-
* val f = future { sys.error("failed") }
533-
* val g = future { 5 }
534-
* val h = f either g
535-
* await(h, 0) // evaluates to either 5 or throws a runtime exception
536-
* }}}
537-
*/
538-
def either[U >: T](that: Future[U]): Future[U] = {
539-
val p = Promise[U]()
540-
val completePromise: PartialFunction[Try[U], _] = { case result => p tryComplete result }
541-
542-
this onComplete completePromise
543-
that onComplete completePromise
544-
545-
p.future
546-
}
547-
548525
}
549526

550527

0 commit comments

Comments
 (0)