Example usage for com.google.common.collect ImmutableSet copyOf

List of usage examples for com.google.common.collect ImmutableSet copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet copyOf.

Prototype

public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements) 

Source Link

Usage

From source file:org.eel.kitchen.jsonschema.keyword.EnumKeywordValidator.java

public EnumKeywordValidator(final JsonNode schema) {
    super("enum", NodeType.values());
    enumNode = schema.get(keyword);//w w w .  j  a  v a 2s.com
    enumValues = ImmutableSet.copyOf(enumNode);
}

From source file:com.attribyte.essem.model.Host.java

/**
 * Creates a host.//  w  ww. ja  v  a  2 s.  c  om
 * @param name The host name.
 * @param instances A set of instances associated with the host.
 */
public Host(final String name, final Collection<String> instances) {
    this.name = name;
    this.instances = instances != null ? ImmutableSet.copyOf(instances) : ImmutableSet.<String>of();
}

From source file:org.onosproject.provider.lldp.impl.SuppressionRules.java

public SuppressionRules(Set<DeviceId> suppressedDevice, Set<Device.Type> suppressedType,
        Map<String, String> suppressedAnnotation) {

    this.suppressedDevice = ImmutableSet.copyOf(suppressedDevice);
    this.suppressedDeviceType = ImmutableSet.copyOf(suppressedType);
    this.suppressedAnnotation = ImmutableMap.copyOf(suppressedAnnotation);
}

From source file:org.elasticsearch.common.inject.internal.SourceProvider.java

private SourceProvider(Iterable<String> classesToSkip) {
    this.classNamesToSkip = ImmutableSet.copyOf(classesToSkip);
}

From source file:de.cosmocode.commons.reflect.DefaultClasspath.java

public DefaultClasspath(String classpath) {
    Preconditions.checkNotNull(classpath, "Classpath");

    this.entries = ImmutableSet
            .copyOf(Iterables.transform(SPLITTER.split(classpath), new Function<String, URL>() {

                @Override/*from w ww .j a  v a 2 s .co  m*/
                public URL apply(String from) {
                    try {
                        return new File(from).toURI().toURL();
                    } catch (MalformedURLException e) {
                        throw new ExceptionInInitializerError(e);
                    }
                }

            }));
}

From source file:org.onosproject.net.optical.device.FilteredAnnotation.java

/**
 * Creates filtered {@link Annotations} view based on {@code delegate}.
 *
 * @param delegate input {@link Annotations}
 * @param keys to filter-out//from   ww  w  .j a  v a  2 s.c o m
 */
public FilteredAnnotation(Annotations delegate, Set<String> keys) {
    this.delegate = checkNotNull(delegate);
    this.filtered = ImmutableSet.copyOf(keys);
}

From source file:org.apache.brooklyn.location.jclouds.pool.MachineSet.java

public MachineSet(NodeMetadata... nodes) {
    members = ImmutableSet.copyOf(nodes);
}

From source file:org.jboss.weld.util.collections.WeldCollections.java

/**
 *
 * @return//from  www  . j  a v a2 s . com
 */
public static <T> Set<T> immutableGuavaSet(Set<T> set) {
    if (set.isEmpty()) {
        return Collections.emptySet();
    }
    if (set instanceof ImmutableSet<?>) {
        return set;
    }
    return ImmutableSet.copyOf(set);
}

From source file:org.apache.sentry.core.common.ActiveRoleSet.java

public ActiveRoleSet(Set<String> roles) {
    this(false, ImmutableSet.copyOf(roles));
}

From source file:com.google.gxp.compiler.alerts.AlertSet.java

/**
 * Creates AlertSet containing specified Alerts.
 *
 * <p>This constructor is package private as only AlertSetBuilder should call
 * it./*from ww  w .  j  av  a 2 s.co m*/
 */
AlertSet(Iterable<Alert> alerts) {
    this.alerts = ImmutableSet.copyOf(alerts);
}