Scala:忽略Future的返回值,但将它们链接起来

Tim*_*eph 7 scala future for-comprehension

当我不关心返回值时,我该如何编写代码.

例:

for {
    a <- getA // I do not care about a, but I need to wait for the future to finish
    b <- getB
} yield (b)
Run Code Online (Sandbox Code Playgroud)

moh*_*hit 9

像这样

for {
     _ <- getA 
     b <- getB
} yield (b)
Run Code Online (Sandbox Code Playgroud)