I am new to scala. I need to understand one basic idea.
In scala, we have map,filter,groupBy etc..
Are they functions? or Are they methods?
They are methods. See, e.g. the
There aren't really functions in the Scala Core Language.
Basically, the support for functions in Scala is similar to Java: any object which has a method called
apply, can be used as a "function". There are a number of traits in the Scala Standard Library, called
Function2[-T1, -T2, +R],
Function3[-T1, -T2, -T3, +R], etc. which can be instantiated using special literal syntax like this:
val fn = (i: Int, j: Int) => i + j
There are two ideas what it means to be a "function" in Scala:
groupBy, are neither, they aren't even objects. They are methods.