Future.sequence is your friend here. It lets you take bunch of Futures
of things, and turn it into /one/ Future of the bunch of things that’s
the results from all the input Futures. Or, for example,
Seq[Future[A]] => Future[Seq[A]]
.
So in your case,
val stuff: Seq[A] = ...
def query(thing: A): B = ...
val futures: Seq[Future[B]] = stuff.map(a => Future(query(a)))
val futureBs: Future[Seq[B]] = Future.sequence(futures)