scala - How to return an option when reading a vector -
Reading from a vector, I do not want to return anything while trying to read an index, which is not anything else Is there any standard way to do this?
you lift
:
val V = Vector (1, 2, 3) v.lift (0) // some (1) v.lift (5) // none
for any partial function Note the work.
Comments
Post a Comment