How do I cast this to an Int and not Some(Int)
Some(Int)
val a: Option[Any] = Some(1)
I tried toInt and it gave an error
toInt
Using .asInstanceOf method
.asInstanceOf
a.getOrElse(0).asInstanceOf[Int]
I have to note that this is unsafe cast: if your Option contains not Int, you'll get runtime exception.