Hi,
With Scala Currying, we can take a function that takes multiple arguments and turns it into a series of functions that take single arguments each. These come in handy working with higher-order functions. With this, we can also fill in only the arguments we have yet.
scala> def mul(a:Int,b:Int)=a*b
mul: (a: Int, b: Int)Int
scala> mul(3,4)
The output will be:
Int = 12
There is another way to do this mention below:
scala> def mul(a:Int)(b:Int)=a*b
mul: (a: Int)(b: Int)Int
scala> val mid=mul(3)(_)
mid: Int => Int = $$Lambda$1540/90644757@43fe3f7
scala> mid(4
The output will be same:
Int =12
If you want to know more about Apache Spark Scala, It's highly recommended to go for the Spark Training today.