Use lambdas for Java strategies when the behavior is small and the strategy contract is naturally functional.
Modern Java often implements Strategy more cleanly with a functional interface and a lambda than with a pile of small named classes.
1@FunctionalInterface
2public interface RetryPolicy {
3 Duration nextDelay(int attempt);
4}
Then callers can supply strategies inline:
1RetryPolicy exponential = attempt -> Duration.ofMillis(100L << attempt);
2RetryPolicy fixed = attempt -> Duration.ofMillis(250);
Lambdas are a strong fit when:
Prefer concrete classes when:
The right implementation style is the one that makes the behavior easiest to recognize, not the one that uses the most modern syntax.