Waiting for another future to end to return a function
问题 Let's say I have a function func1 that needs to return a Future with two integers. Each of the two values are returned by independent futures, like so: def f1 = Future { 1 } def f2 = Future { 2 } def func1 : Future[(Int,Int)] = { val future1 = f1 future1.map { result1 => result1 * 10 } val future2 = f2 future2.map { result2 => result2 * 20 } } I need future1 wait until future2 ends (or vice versa) to return both results as (Int,Int) . How can this be accomplished? 回答1: That's precisely what