Experimenting with map, flatMap and flatten and the following output is unexpected :
case class T(data: String)
val s = Set(T("1") , T("2"))
val a: Array[Byte] = s.map(transaction => transaction.data).flatten.toArray
Should a not be of type Array[String]? , as data is of type String. Why is a of type Array[Byte]?