zstan commented on a change in pull request #484: URL: https://github.com/apache/ignite-3/pull/484#discussion_r764561301
########## File path: modules/core/src/main/java/org/apache/ignite/internal/util/ArrayUtils.java ########## @@ -296,6 +299,21 @@ public static boolean nullOrEmpty(boolean[] arr) { return nullOrEmpty(vals) ? Collections.emptyList() : Arrays.asList(vals); } + /** + * Converts array to {@link Set}. + * + * <p>Note that unlike {@link Arrays#asList(Object[])}, this method is {@code null}-safe. If {@code null} is passed in, then empty set + * will be returned. + * + * @param vals Array of values + * @param <T> Array type. + * @return {@link Set} instance for input array. + */ + @SafeVarargs + public static <T> Set<T> asSet(@Nullable T... vals) { + return nullOrEmpty(vals) ? Collections.emptySet() : Stream.of(vals).collect(Collectors.toSet()); Review comment: already rewritten: public static <T> Set<T> asSet(@Nullable T... vals) { if (nullOrEmpty(vals)) { return Collections.emptySet(); } else { HashSet<T> set = new HashSet<>(vals.length); Collections.addAll(set, vals); return set; } } -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org