org.infinispan.jcache.annotation.CollectionsHelper Maven / Gradle / Ivy
package org.infinispan.jcache.annotation;
import java.util.LinkedHashSet;
import java.util.Set;
import static java.util.Collections.addAll;
/**
* An helper class providing useful methods to work with JDK collections.
*
* @author Kevin Pollet (C) 2011 SERLI
*/
public final class CollectionsHelper {
/**
* Disable instantiation.
*/
private CollectionsHelper() {
}
/**
* Creates a {@link java.util.Set} with the given elements.
*
* @param elements the elements.
* @param the element type.
* @return a new {@link java.util.Set} instance containing the given elements.
* @throws NullPointerException if parameter elements is {@code null}.
*/
public static Set asSet(T... elements) {
final Set resultSet = new LinkedHashSet();
addAll(resultSet, elements);
return resultSet;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy