Search code examples
scalaplayframework-2.2enumerator

Play 2.2 - Enumeratee[List[E], E] = enumerate through list of elements element by element


How to transform an Enumerator[List[E]] to act like an Enumerator[E] ?

First, I think about Enumeratee[From, To], but I only found documentation about mapping or filtering.

Is it possible with an Enumeratee to split a List[E] into multiple E ?


Solution

  • I found something that works but IMHO, it is a workaround.

    def flatEnumeratee[To] = Enumeratee.mapConcat[List[To]](identity)
    

    I thought that something will be provided without the need of specified the identity function.