Skip to content

Commit 806f456

Browse files
committed
Nitfix confusing optional and returns
1 parent b6c4fe8 commit 806f456

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

procedures/pipelines-facade/src/main/java/org/neo4j/gds/procedures/pipelines/LinkPredictionPredictPipelineBaseConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ default void validateParameterCombinations() {
149149
);
150150
validateStrategySpecificParameters(approximateStrategyParameters, "less than 1");
151151

152-
topN().orElseThrow(() -> MissingParameterExceptions.missingValueFor("topN", Collections.emptyList()));
152+
if (topN().isEmpty()) {
153+
throw MissingParameterExceptions.missingValueFor("topN", Collections.emptyList());
154+
}
153155
}
154156
}
155157

procedures/pipelines-facade/src/main/java/org/neo4j/gds/procedures/pipelines/NodeRegressionPredictConfigPreProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class NodeRegressionPredictConfigPreProcessor {
4040

4141
void enhanceInputWithPipelineParameters(Map<String, Object> userInput) {
4242
Optional.ofNullable(userInput.get("modelName"))
43-
.map(modelName -> {
43+
.ifPresent(modelName -> {
4444
assert modelCatalog != null : "ModelCatalog should have been set in the ExecutionContext by this point!!!";
4545

4646
var trainedModel = modelCatalog.get(
@@ -61,7 +61,6 @@ void enhanceInputWithPipelineParameters(Map<String, Object> userInput) {
6161

6262
userInput.put("targetNodeLabels", combinedTargetNodeLabels);
6363
userInput.put("relationshipTypes", combinedRelationshipTypes);
64-
return userInput;
6564
});
6665
}
6766
}

0 commit comments

Comments
 (0)