Scala Create Map From List Of Tuples, You're using foreach, which returns Unit, where you want to use map, which returns an Array[B].