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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

asp.net mvc - How to attach sql database to a javascript graph -

c# - How to know the number of Threads created and limit the Tasks accordingly -