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

com.github.liuyehcf.framework.compile.engine.utils.SetUtils Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package com.github.liuyehcf.framework.compile.engine.utils;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * Set工具类
 *
 * @author hechenfeng
 * @date 2018/04/16
 */
public abstract class SetUtils {

    @SafeVarargs
    public static  Set of(T... elements) {
        return new HashSet<>((Arrays.asList(elements)));
    }

    public static  Set extract(Set set, T element) {
        Set newSet = new HashSet<>(set);
        newSet.remove(element);
        return newSet;
    }

    public static  Set of(Set set1, Set set2) {
        Set newSet = new HashSet<>(set1);

        newSet.addAll(set2);

        return newSet;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy