Functional Programming in Java


This is the blog associated with my book "Functional Programming in Java", published by Manning (https://manning.com/books/functional-programming-in-java). Functional Programming is not tied to any "functional" language. It is a way of thinking and a paradigm for writing programs. Some languages are more "functional friendly", and if you intend to write program using the functional paradigm, you should probably pick one of them... if you can. This blog (and the associated book) is dedicated to those who can't.


  1. Folding the Universe, part III : Java 8 List and Stream

    This is the third article in a series about applying functional programming techniques like folding to Java programs. This series is a complement to my book Functional Programming in Java published by Manning. First two articles are available here: Folding the Universe, part I: Folding in Java Folding the Universe,…


  2. Folding the Universe, part II: Abstracting recursion

    This is a series of articles complementing my book, Functional Programming in Java. Previous articles in this series may be found here: Folding the Universe, part I In the the previous article in this series, I showed how to write a functional Java program solving the Knapsack problem, which consists…


  3. Folding the Universe, part I

    Folding the Universe is actually the title of a book by Peter Engel which is subtitled "Origami From Angelfish to Zen", suggesting that anything in the universe may be modelled out of folded paper. The analogy with computer programming is interesting since, in functional programming, nearly every problem can be…


  4. Stack safe recursion in Java

    In this article, excerpted from my book Functional Programming in Java, I explain how to use recursion while avoiding the risk of a StackOverflowException. Corecursion is composing computing steps by using the output of one step as the input of the next one starting with the first step. Recursion is…


  5. Recursive lambdas in Java 8

    Many Java programmers believe that is is not possible to create recursive lambdas. This is simply not true. One question that comes back often about Java 8 lambdas is "Can they be recursive?". The most current answer is simply no, although one may find answers stating that lambdas were once…