scala - How to convert an anonymous function to a method value? -
with code
val foo = list('a', 'b', 'c') astring.forall(foo.contains(_))
intellij highlights foo.contains(_) , suggests "anonymous function convertible method value". have researched eta expansion, unable see how improve particular piece of code. ideas?
i believe it's saying have
val foo = list('a', 'b', 'c') astring.forall(foo.contains)
note we're not explicitly converting foo.contains
method here anonymous function.
Comments
Post a Comment