Convert List[Any] to Array[String]
scala> val stringAry: Array[String] = (List("a", 1) map (_.toString)).toArraystringAry: Array[String] = Array(a, 1)
Create typeOf method to determine the type of each element in array
scala> def typeOf[T: Manifest](t: T): Manifest[T] = manifest[T]typeOf: [T](t: T)(implicit evidence$1: Manifest[T])Manifest[T]
Print results
scala> stringAry.foreach( i => println(typeOf(i)) )java.lang.String
java.lang.String
Thanks - this was very helpful
ReplyDeleteThis comment has been removed by the author.
ReplyDelete