nfsantos commented on code in PR #1690:
URL: https://github.com/apache/jackrabbit-oak/pull/1690#discussion_r1749959652


##########
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java:
##########
@@ -81,4 +83,69 @@ public static <T> Set<T> toSet(final Iterator<T> iterator) {
         return result;
     }
 
-}
+    /**
+     * Convert a vararg list of items to a set.  The returning set is mutable 
and supports all optional operations.
+     * @param elements elements to convert
+     * @return the set
+     * @param <T> the type of the elements
+     */
+    @SafeVarargs
+    public static <T> Set<T> toSet(final T... elements) {
+        final Set<T> result = new HashSet<>(elements.length);

Review Comment:
   I'm not sure about the performance implications of using load factor of 1, I 
guess it will increase collisions which may degrade performance, of both 
inserts and lookups. As the returned map is mutable, we can expect that it will 
modified, so I think it's safer to keep the default load factor, which I guess 
was carefully chosen by very clever people to provide good performance. If we 
create the map with load factor of 1 and then it is used for a performance 
critical operation, we risk that the map will perform more poorly than if it 
had been created with the default load factor. 



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