I have a list of Integer which I need to convert to Option, however when List is empty i need to assign it as none. please suggest
val list: List[Int] = List()
val x = option(list)
if list is empty x should be none and if list has some value say List(1,2) then x should be Some(List(1,2))
please suggest