exceptionfactory commented on code in PR #8963:
URL: https://github.com/apache/nifi/pull/8963#discussion_r1642914084
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/manifest/StandardRuntimeManifestService.java:
##########
@@ -228,23 +227,18 @@ private static ControllerServiceDefinition
getManifestControllerServiceDefinitio
return definition;
}
- private static List<AllowableValue> getManifestAllowableValues(final
PropertyDescriptor propertyDescriptor) {
- if (propertyDescriptor.getAllowableValues() == null) {
- return List.of();
- }
-
- final List<AllowableValue> allowableValues = new ArrayList<>();
- for (final org.apache.nifi.components.AllowableValue allowableValue :
propertyDescriptor.getAllowableValues()) {
- final AllowableValue manifestAllowableValue = new AllowableValue();
-
manifestAllowableValue.setDescription(allowableValue.getDescription());
- manifestAllowableValue.setValue(allowableValue.getValue());
-
manifestAllowableValue.setDisplayName(allowableValue.getDisplayName());
- allowableValues.add(manifestAllowableValue);
- }
- return allowableValues;
+ private static List<AllowableValue> getAllowableValues(final
PropertyDescription propertyDescription) {
+ return
Optional.ofNullable(propertyDescription.getAllowableValues()).orElse(List.of())
Review Comment:
This should use `Collections.emptyList()` to avoid unnecessary creation:
```suggestion
return
Optional.ofNullable(propertyDescription.getAllowableValues()).orElse(Collections.emptyList())
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]