
Learning Java Functional Programming
By :

Recursion is a powerful functional programming technique that lends itself to more elegant and succinct solutions than an iterative approach. Recursion is the technique where a method, either directly or indirectly, calls itself. A lambda expression can also call itself recursively. The discussion in this chapter will focus on method recursion. However, keep in mind that the ideas and concepts apply equally to recursive lambda expressions.
In this chapter, we will:
Recursion is not new to Java 8. To illustrate recursion using a method, let's examine what is probably the most commonly used problem to illustrate recursion—the factorial problem. It is defined as follows:
f(1) = 1 f(n) = n * f(n-1) where n > 0
The following is an iterative...
Change the font size
Change margin width
Change background colour