Stop using, opt match { case Some(x) => f(x); case None => y } Stop using, http://opt.map (f).getOrElse(y) Use, opt.fold(y)(f) I feel like I'm very late to this party.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Next time use a poll. If you need to pacify the masses let them vote.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I used fold a lot in the past, for me it is very clear in particular if the args are just one word. One day a friend of mine opened a PR to replace some folds with map(..).getOrElse because my code was not easy to read :). I guess it is controversial...
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I used to work on a team of three devs. One person preferred fold, another match and the third map + getOrElse. We ended up having to ban this topic from code reviews!
-
I am laughing, I have similar things.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
