Help AI coding agents use Java Optional well in new code and cleanups, without replacing one antipattern with another.
100
100%
Does it follow best practices?
Impact
100%
2.08xAverage score across 4 eval scenarios
Passed
No known issues
Create RetryBackoff.java. Assume Java 17.
Implement:
Duration backoff(Config config, int attempt, HttpResponse<?> response)Rules:
response is not null and has a valid Retry-After header, return that duration.Retry-After value is a positive whole number of seconds.config.baseDelay().multipliedBy(1L << Math.min(attempt - 1, 8)).Optional<Duration> parseRetryAfter(String value).record Config(Duration baseDelay) {}