Collector
gears.async.Future.Collector
Collects a list of futures into a channel of futures, arriving as they finish.
Attributes
- See also
-
Future.awaitAll and Future.awaitFirst for simple usage of the collectors to get all results or the first succeeding one.
- Example
-
// Sleep sort val futs = numbers.map(i => Future(sleep(i.millis))) val collector = Collector(futs*) val output = mutable.ArrayBuffer[Int]() for i <- 1 to futs.size: output += collector.results.read().await
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class MutableCollector[T]
Members list
In this article