In Java one way of functional programming is using Lambda expression where functions are passed as argument in cases where Functional Interfaces are involved.
Why is Scala said to be more functional than java?
Scala simply has more functional features built right into the language. Among others, some important ones are that it has collections that are evaluated lazily, you can use the apply operator on functions and you can use partial function application.
For example, when you have a function in Java you can only apply it by calling the method that is defined in the functional interface:
In Scala, you can directly apply a function to some arguments by putting the arguments in parentheses after the function name:
In Scala, you can also apply functions partially to get a new function:
In Java, you can't do this without writing utility methods:
These are but a few of the functional features that Scala has and Java doesn't.
Scala programming is more functional than Java. Unlike Java to apply function we do not require a functional interface to exist. We can apply it directly. Also in Scala we require to write shorter code. Which of these or any other is the primary advantage of Scala?
In Java we can do functional programming but not without a functional interface. In Scala there is not such restrictions. We can direclty apply function. This difference is there because functions are not first class citizens in Java.