Transforming Enumeratee into the Future [List] Scala

What is the standard way to convert Enumeratorto Future[List]in the Scala platform?

+4
source share
1 answer

You can use a method runwith a type parameter Iteratee[E, List[E]]to get Future[List[E]].

There is a method getChunksthat creates Iteratee[E, List[E]]:

myEnumerator run Iteratee.getChunks

You can use Iteratee.foldto create one Iterateemanually. If you want to keep the order of the elements, you can use reverseon List.

myEnumerator run Iteratee.fold(List.empty[E]){ (l, e) => e :: l } map { _.reverse }
+5
source

All Articles