Does Scala have any syntactic sugar to replace the following code:
val thread = new Thread(new Runnable {
def run() {
println("hello world")
}
})
with something more like:
val thread = new Thread(() => println("hello world"))
in cases when the trait/interface needs only one method to be implemented? If not, is there any chance to have this feature in Scala in the future? It is especially useful when one deals with Java classes.
I found a similar question asked three years ago: Generically implementing a Java Single-Abstract-Method interface with a Scala closure? The answer says we should have the feature in Scala 2.10. I've looked for Single Abstract Method keyword but I have not found anything. What's happened with the feature?