Вопрос

What is a standard way to convert Enumerator to Future[List] in Play Scala framework?

Это было полезно?

Решение

You could use method run with parameter of type Iteratee[E, List[E]] to get Future[List[E]].

There is method getChunks, that creates Iteratee[E, List[E]]:

myEnumerator run Iteratee.getChunks

You could use Iteratee.fold to create such Iteratee manually. In case you want to preserve elements order you could use reverse on List.

myEnumerator run Iteratee.fold(List.empty[E]){ (l, e) => e :: l } map { _.reverse }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top