Hey,
Scala allows the definition of a higher-order function. These are functions that take other functions as parameters, or whose result is a function. In the following example, apply () function takes another function 'f' and a value 'v' and applies the function to v.
object Test {
def main(args: Array[String]) {
println( apply( layout, 10) )
}
def apply(f: Int => String, v: Int) = f(v)
def layout[A](x: A) = "[" + x.toString() + "]"
When the above code is compiled and executed, it produces the following result
C:/>scalac Test.scala
C:/>scala Test
[10]
C:/>
If you want to know more about Apache Spark Scala, It's highly recommended to go for the Spark Certification Course today.