Here is an example using the ycombinator to transparently add memoization to a function. This enables you to get the performance boost of dynamic programming in java without having to rewrite recursion as iteration. (The code uses jdk8 but could be done without it).