I want to take this val:
val f = List(Future(1), Future(2), Future(3))
Perform some operation on it (I was thinking flatten)
Future.sequence takes a List[Future[T]] and returns a Future[List[T]].
Future.sequence
List[Future[T]]
Future[List[T]]
You can do
Future.sequence(f)
and then use map or onComplete on it to access the list of values.
map
onComplete