Skip to content

Commit 044ceb7

Browse files
Apply suggestions from Javi's code review
Co-authored-by: Francisco Javier Tirado Sarti <[email protected]>
1 parent 1c9cad4 commit 044ceb7

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

validation/src/main/java/io/serverlessworkflow/validation/WorkflowValidatorImpl.java

+4-16
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,7 @@ && isMissingRetryDefinition(
373373
private boolean isMissingFunctionDefinition(
374374
String functionName, List<FunctionDefinition> functions) {
375375
if (functions != null) {
376-
return functions.stream()
377-
.filter(f -> f.getName().equals(functionName))
378-
.findFirst()
379-
.orElse(null)
380-
== null;
376+
return !functions.stream().anyMatch(f -> f.getName().equals(functionName));
381377
} else {
382378
return true;
383379
}
@@ -388,23 +384,15 @@ private boolean isMissingEventsDefinition(String eventName, List<EventDefinition
388384
return false;
389385
}
390386
if (events != null) {
391-
return events.stream().filter(e -> e.getName().equals(eventName)).findFirst().orElse(null)
392-
== null;
387+
return !events.stream().anyMatch(e -> e.getName().equals(eventName));
393388
} else {
394389
return true;
395390
}
396391
}
397392

398393
private boolean isMissingRetryDefinition(String retryName, List<RetryDefinition> retries) {
399-
if (retries != null) {
400-
return retries.stream()
401-
.filter(f -> f.getName() != null && f.getName().equals(retryName))
402-
.findFirst()
403-
.orElse(null)
404-
== null;
405-
} else {
406-
return true;
407-
}
394+
return retries == null || ! retries.stream()
395+
.anyMatch(f -> f.getName() != null && f.getName().equals(retryName));
408396
}
409397

410398
private static final Set<String> skipMessages =

0 commit comments

Comments
 (0)