The underscore is a placeholder for a variable. It's not, in and of itself, a function. flatMap
requires a function.
Also, in this case, there is a flatten
method which is defined on List
for which Option
has within the Predef
an implicit conversion such that what you've written can be condensed into just that call, List(Some(1)).flatten
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…