Recursive Builder Pattern

How to mimic self keyword in JAVA? First, check out our tutorial about Recursive Builder Pattern to understand why it is even needed.

We all know how handy is the builder pattern. Stop. Maybe not all? Do not worry, builder pattern is well explained in “Design Patterns” from O’Reilly. You will get it in 10 mins. The most important reason why it is good to have a builder is to avoid numerous parameters being passed to the constructor. The builder pattern has many variations, but for the sake of this tutorial, we will use the simplest possible form – static inner class. Take a look: