You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "reschke (via GitHub)" <gi...@apache.org> on 2024/09/09 09:48:21 UTC

Re: [PR] OAK-11073: add Set.of(varargs) and stream support [jackrabbit-oak]

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


##########
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:
   or specify the load factor as 1?



-- 
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-unsubscribe@jackrabbit.apache.org

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