Saturday, 25 April 2009

Scala - how to cast

How to cast a list of one type to something else in Scala:

def casting(params: List[Object]) {
val strParams = params.map { _.asInstanceOf[String] }
println(strParams)
}

No comments:

Post a comment