Is it possible to write an "asInstanceOfOption" method that would do what is intended by the following (bogus) code?
def asInstanceOfOption[T](o: Any): Option[T] =
if (o.isInstanceOf[T]) Some(o.asInstanceOf[T]) else None
Is it possible to write an "asInstanceOfOption" method that would do what is intended by the following (bogus) code?
def asInstanceOfOption[T](o: Any): Option[T] =
if (o.isInstanceOf[T]) Some(o.asInstanceOf[T]) else None