A little Scala Quiz ;-)

These two lines returns the same result. What is the name of the second line special shorthand ?

1) args.foreach( (arg : String) => println(arg))

2) args.foreach(println)

Response :  Partially applied function

It can be used when a function literal consist of one statement that takes a single argument.

Leave a Comment

Your email address will not be published. Required fields are marked *