class EventRetrievalScheduledTask extends BaseTask implements Runnable {

    public List<Device> filterByExponentialBackOff(final List<Device> devicesToFilter) {

        final Predicate<Device> hasNoConnectionFailure = d -> !d.hasConnectionFailures();

        final Predicate<Device> hasLastConnectionFailureBeforeThreshold = d -> this.calculateThresholdForDevice(d);

        return devicesToFilter.stream().filter(hasNoConnectionFailure.or(hasLastConnectionFailureBeforeThreshold))
                .collect(Collectors.<Device> toList());
    }

}