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 -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -