rishabhdaim commented on code in PR #2212:
URL: https://github.com/apache/jackrabbit-oak/pull/2212#discussion_r2034311505


##########
oak-exercise/src/main/java/org/apache/jackrabbit/oak/exercise/security/authorization/models/simplifiedroles/Role.java:
##########
@@ -44,7 +49,9 @@ private Role(long permissions, String... privilegeNames) {
 
     private Role(@NotNull Role base, long permissions, String... 
privilegeNames) {
         this.permissions = base.permissions|permissions;
-        this.privilegeNames = 
ImmutableSet.<String>builder().addAll(base.privilegeNames).add(privilegeNames).build();
+        this.privilegeNames = Collections.unmodifiableSet(
+                (Set<String>) Stream.concat(base.privilegeNames.stream(), 
Arrays.stream(privilegeNames))
+                        .collect(Collectors.toCollection(LinkedHashSet::new)));

Review Comment:
   This would not retain the original order to elements and that would change 
the code behaviour since ImmutableSet retains the original order.



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

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

Reply via email to