class RepeatStrategies {

    public static IntFunction<Completable> repeatWithExponentialBackoff(final int maxRepeats,
                                                                        final Duration initialDelay,
                                                                        final Executor timerExecutor) {
        requireNonNull(timerExecutor);
        final long initialDelayNanos = initialDelay.toNanos();
        return repeatCount -> {
            if (repeatCount > maxRepeats) {
                return terminateRepeat();
            }
            return timerExecutor.timer(initialDelayNanos << (repeatCount - 1), NANOSECONDS);
        };
    }

    private  RepeatStrategies();

}