briansolo1985 commented on code in PR #8963:
URL: https://github.com/apache/nifi/pull/8963#discussion_r1644234243


##########
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:
   List.of() does not create a new instance, it returns a static constant 
immutable list just like Collections.emptyList(). I prefer the former due it's 
shortness and conciseness.



-- 
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]

Reply via email to