Why does the definition of Array.map in Scala is "throw new Error()"
- by Oscar Reyes
The source code of map for Array is:
override def map[B](f: A => B): Array[B] = throw new Error()
But the following works:
scala> val name : Array[String]= new Array(1)
name: Array[String] = Array(null)
scala> name(0)="Oscar"
scala> val x = name.map { ( s: String ) => s.toUpperCase }
x: Array[java.lang.String] = Array(OSCAR)