Skip to content

Instantly share code, notes, and snippets.

@sherman
Created May 22, 2013 16:06
Show Gist options
  • Save sherman/5628781 to your computer and use it in GitHub Desktop.
Save sherman/5628781 to your computer and use it in GitHub Desktop.
so functional
new Function<FunctionParameters, Optional<QsDeploymentResult>>() {
@Override
public Optional<QsDeploymentResult> apply(@Nullable FunctionParameters parameters) {
assert null != parameters;
return from(ImmutableList.of(parameters.result)).filter(
or(
// status ok
not(redeployStrategies.statusIsFailed()),
// failed iteration was too long time ago
and(
redeployStrategies.statusIsFailed(),
redeployStrategies.qodeDeploymentIsExpired()
),
// too many iterations
and(
redeployStrategies.statusIsFailed(),
redeployStrategies.tooManyFailedIterations()
)
)
).first();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment