I have a block of code where I call methodTwo if methodOne returns null. If methodTwo returns null, I call methodThree
Optional<Workflow> optionalWorkflow = remoteWorkflowProvider.getWorkflow(request);
if (!optionalWorkflow.isPresent()) {
log.info("Cannot find workflow using remoteWorkflowProvider");
optionalWorkflow = featureBasedWorkflowProvider.getWorkflow(request);
}
if (!optionalWorkflow.isPresent()) {
log.info("Cannot find workflow using featureBasedWorkflowProvider");
optionalWorkflow = legacyWorkflowProvider.getWorkflow(request);
}
Is there a better way of doing this?