mmoayyed commented on code in PR #1004:
URL: https://github.com/apache/syncope/pull/1004#discussion_r1979035955


##########
client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMRealmPolicyProvider.java:
##########
@@ -77,7 +77,7 @@ public void add(final RealmTO realmTO, final RepeatingView 
view) {
                 new PropertyModel<>(realmTO, "authPolicy"),
                 false);
         authPolicy.setChoiceRenderer(new PolicyRenderer(authPolicies));
-        
authPolicy.setChoices(authPolicies.keySet().stream().collect(Collectors.toList()));
+        authPolicy.setChoices(new ArrayList<>(authPolicies.keySet()));

Review Comment:
   Sure. The following comes to mind:
   
   `new ArrayList<>(collection)` directly copies elements from the given 
collection using the `addAll()` method. This is an optimized operation. The 
stream variant of course has the overhead of creating a stream, iterating over 
elements, and creating a collector. The proposed syntax is also more compact 
with fewer calls, and you can also immediately see the list implementation 
used, unlike the toList() call where the implementation is somewhat unclear 
unless you look up docs or are intimately familiar with what is returned. 
   
   Streaming would be useful if the intention is to do extra filtering or other 
intermediate ops, or if parallel processing is required, etc.



-- 
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: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to