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

net.dongliu.commons.lang.collection.Sets Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version
package net.dongliu.commons.lang.collection;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * utils method for set
 *
 * @author Dong Liu
 */
public class Sets {
    /**
     * get a set.
     * 

* {@code Set list = Sets.of("test", "test2");} *

*/ @SafeVarargs public static Set of(T... values) { Set set = new HashSet<>(); Collections.addAll(set, values); return set; } /** * get immutable set */ @SafeVarargs public static Set immutable(T... values) { return Collections.unmodifiableSet(of(values)); } /** * get immutable list */ public static Set immutable(Set set) { return Collections.unmodifiableSet(set); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy