O'Reilly logo

Learning Java Functional Programming by Richard M Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

Recursion can be a very useful technique to create elegant and maintainable code. This technique involves a method or lambda expression calling itself either directly or indirectly. While it may require more time and space than an equivalent iterative solution, in many situations, it will be a better solution if these expenses do not outweigh the benefits of using recursion.

Many data structures are recursive in nature. Such data structures are self-referencing. They have references within the structure to same structure. For example, a linked list node will have a reference to a linked list node such as to the next node in the list. We used a left and right node reference in our tree examples to illustrate a recursive data structure in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required