Another Scala nested Option + flatMap example
After yesterday’s Scala nested Option + flatMap/for example, here’s another example of plowing through nested Options with flatMap
. First, start with some nested options:
val o1 = Option(1) val oo1 = Option(o1) val ooo1 = Option(oo1)
Here are those same three lines, with the data type for each instance shown in the comments:
This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.