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:com.google.gxp.compiler.depend.DependencyNode.java

public DependencyNode(TemplateName.FullyQualified name, long lastModified, Set<Callable> requirements) {
    this.name = Preconditions.checkNotNull(name);
    this.lastModified = lastModified;
    this.requirements = ImmutableSet.copyOf(requirements);
}

From source file:org.sonar.server.health.Health.java

public Health(Builder builder) {
    this.status = builder.status;
    this.causes = ImmutableSet.copyOf(builder.causes);
}

From source file:com.github.nyrkovalex.deploy.me.descriptor.DeploymentDescriptor.java

public DeploymentDescriptor(Iterable<Application> applications) {
    this.applications = ImmutableSet.copyOf(applications);
}

From source file:org.jclouds.nodepool.config.BindJcloudsModules.java

@Provides
@Singleton//from ww  w  .ja  v a 2  s .co  m
@Backend
protected Set<Module> provideBackendModules(@Named(NodePoolProperties.BACKEND_MODULES) String moduleString) {
    return ImmutableSet
            .copyOf(Iterables.transform(Splitter.on(',').split(moduleString), new Function<String, Module>() {

                @Override
                public Module apply(String input) {
                    try {
                        return Module.class.cast(Class.forName(input).newInstance());
                    } catch (InstantiationException e) {
                        throw Throwables.propagate(e);
                    } catch (IllegalAccessException e) {
                        throw Throwables.propagate(e);
                    } catch (ClassNotFoundException e) {
                        throw Throwables.propagate(e);
                    }
                }
            }));
}

From source file:org.jclouds.cloudsigma.functions.SplitNewlinesAndReturnSecondField.java

@Override
public Set<String> apply(HttpResponse response) {
    return ImmutableSet
            .copyOf(Iterables.filter(Iterables.transform(super.apply(response), new Function<String, String>() {

                @Override//from  www.  j  av a 2 s . c o m
                public String apply(String arg0) {
                    if (arg0 == null)
                        return null;
                    Iterable<String> parts = Splitter.on(' ').split(arg0);
                    if (Iterables.size(parts) == 2)
                        return Iterables.get(parts, 1);
                    else if (Iterables.size(parts) == 1)
                        return Iterables.get(parts, 0);
                    return null;
                }

            }), Predicates.notNull()));
}

From source file:com.google.doubleclick.openrtb.MapperUtil.java

@SuppressWarnings("unchecked")
public static <E extends Enum<E>, T> ImmutableSet<T>[] multimapEnumToSets(ImmutableMultimap<E, T> mmap) {
    E iMax = Collections.max(mmap.keySet());
    ImmutableSet<T>[] setArray = new ImmutableSet[iMax.ordinal() + 1];
    for (E key : mmap.keySet()) {
        setArray[key.ordinal()] = ImmutableSet.copyOf(mmap.get(key));
    }//w w w.jav  a2  s.  c  o m
    return setArray;
}

From source file:eu.redzoo.reactive.kafka.rest.Environment.java

public ImmutableMap<String, String> getConfigValues(String... names) {
    return getConfigValues(ImmutableSet.copyOf(names));
}

From source file:google.registry.mapreduce.inputs.ConcatenatingInput.java

public ConcatenatingInput(Iterable<? extends Input<? extends T>> inputs, int numShards) {
    this.inputs = ImmutableSet.copyOf(inputs);
    this.numShards = numShards;
}

From source file:com.proofpoint.discovery.store.DynamicUpdateListener.java

private static Set<String> getTypes(Entry newEntry) {
    return ImmutableSet.copyOf(transform(newEntry.getValue(), Service::getType));
}

From source file:com.google.devtools.build.lib.pkgcache.LoadingResult.java

public LoadingResult(boolean hasTargetPatternError, boolean hasLoadingError,
        Collection<Target> targetsToAnalyze, Collection<Target> testsToRun, String workspaceName) {
    this.hasTargetPatternError = hasTargetPatternError;
    this.hasLoadingError = hasLoadingError;
    this.targetsToAnalyze = targetsToAnalyze == null ? null : ImmutableSet.copyOf(targetsToAnalyze);
    this.testsToRun = testsToRun == null ? null : ImmutableSet.copyOf(testsToRun);
    this.workspaceName = workspaceName;
}