I need to convert Scala Option to Java Optional. I managed to wrote this:
public Optional convertOption2Optional(Option option) {
For a given input parameter opt: Option[T] of some class, you can define a method inside that class like the following:
opt: Option[T]
def toOptional(implicit ev: Null <:< T): Optional[T] = Optional.ofNullable(opt.orNull).
def toOptional(implicit ev: Null <:< T): Optional[T] = Optional.ofNullable(opt.orNull)