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

io.sphere.sdk.utils.SetUtils Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.utils;

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

import static java.util.Arrays.asList;

public final class SetUtils {
    private SetUtils() {
    }

    @SafeVarargs
    @SuppressWarnings("varargs")
    public static  Set asSet(final T ... params) {
        return new HashSet<>(asList(params));
    }

    public static  Set setOf(final T element, final Set set) {
        final Set result = new HashSet<>(1 + set.size());
        result.add(element);
        result.addAll(set);
        return result;
    }

    public static  Set setOf(final T element, final T[] array) {
        return setOf(element, asSet(array));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy