Skip to content

Instantly share code, notes, and snippets.

View MaxiLambda's full-sized avatar
👾
Brain melting

Maximilan Lincks MaxiLambda

👾
Brain melting
  • DSC Software AG
  • Germany
View GitHub Profile
@MaxiLambda
MaxiLambda / Fix.java
Last active December 20, 2025 10:56
Java Code implementing recursion for lambdas.
/**
* Class equipped with static functions used to apply functions to themselves.
* Lambda functions can be made recursive with this technique.
* <p>
* The function below is the recursive definition of the factorial function.
* <pre><code>
* Function<Integer,Integer> rec = fix(f -> n -> (n > 1) ? n * f.get().apply(n - 1) : 1);
* </code></pre>
*/
public final class Fix {