All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.jcache.annotation.CollectionsHelper Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.jcache.annotation;

import static java.util.Collections.addAll;

import java.util.LinkedHashSet;
import java.util.Set;

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