Sets.java

  1. /*
  2.  * Copyright (C) 2011, Christian Halstrick <christian.halstrick@sap.com> and others
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */

  10. package org.eclipse.jgit.lib;

  11. import java.util.Arrays;
  12. import java.util.HashSet;
  13. import java.util.Set;

  14. public class Sets {
  15.     @SafeVarargs
  16.     public static <T> Set<T> of(T... elements) {
  17.         Set<T> ret = new HashSet<>();
  18.         ret.addAll(Arrays.asList(elements));
  19.         return ret;
  20.     }
  21. }