Skip to content

Commit

Permalink
Merge pull request scala#1656 from jsuereth/fix/remove-future-either-…
Browse files Browse the repository at this point in the history
…method

Removing controversial `either` method from Futures API.
  • Loading branch information
adriaanm committed Nov 21, 2012
2 parents aef7912 + ea72460 commit 57b91c5
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/library/scala/concurrent/Future.scala
Original file line number Diff line number Diff line change
Expand Up @@ -522,29 +522,6 @@ trait Future[+T] extends Awaitable[T] {
p.future
}

/** Creates a new future which holds the result of either this future or `that` future, depending on
* which future was completed first.
*
* $nonDeterministic
*
* Example:
* {{{
* val f = future { sys.error("failed") }
* val g = future { 5 }
* val h = f either g
* await(h, 0) // evaluates to either 5 or throws a runtime exception
* }}}
*/
def either[U >: T](that: Future[U]): Future[U] = {
val p = Promise[U]()
val completePromise: PartialFunction[Try[U], _] = { case result => p tryComplete result }

this onComplete completePromise
that onComplete completePromise

p.future
}

}


Expand Down

0 comments on commit 57b91c5

Please sign in to comment.