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.devtools.build.lib.actions.ChangedFilesMessage.java

public ChangedFilesMessage(Set<PathFragment> changedFiles, int changedFileCount) {
    this.changedFiles = ImmutableSet.copyOf(changedFiles);
    this.changedFileCount = changedFileCount;
}

From source file:com.facebook.buck.parser.AbstractTestRuleFactory.java

@Override
public T newInstance(BuildRuleFactoryParams params) throws NoSuchBuildTargetException {
    T builder = super.newInstance(params);

    // labels/*  www  .ja va 2s.com*/
    if (builder instanceof LabelsAttributeBuilder) {
        List<String> labels = params.getOptionalListAttribute("labels");
        ((LabelsAttributeBuilder) builder).setLabels(ImmutableSet.copyOf(labels));
    }

    return builder;
}

From source file:org.asoem.greyfish.utils.space.cluster.DBSCANResult.java

private DBSCANResult(final Collection<? extends DBSCANCluster<O>> clusters, final Collection<? extends O> noise,
        final double eps, final int minPts) {
    this.noise = ImmutableSet.copyOf(noise);
    this.clusters = ImmutableSet.copyOf(clusters);
    this.eps = eps;
    this.minPts = minPts;
}

From source file:com.vsct.dt.strowgr.admin.core.event.in.RegisterServerEvent.java

public RegisterServerEvent(String correlationId, EntryPointKey key, String backend,
        Set<IncomingEntryPointBackendServer> servers) {
    super(correlationId, key);
    this.backend = backend;
    this.servers = ImmutableSet.copyOf(servers);
}

From source file:com.facebook.buck.core.model.targetgraph.impl.TargetGraphAndTargets.java

public TargetGraphAndTargets(TargetGraph targetGraph, Iterable<TargetNode<?>> projectRoots) {
    this.targetGraph = targetGraph;
    this.projectRoots = ImmutableSet.copyOf(projectRoots);
}

From source file:grakn.core.graql.reasoner.cache.Index.java

private Index(Set<Variable> vars) {
    this.vars = ImmutableSet.copyOf(vars);
}

From source file:org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguageProvider.java

/**
 * Provides all {@link MarkupLanguage markup languages} supported by this provider.
 * /*from   w ww. j  a  v a  2s.  c om*/
 * @return the markup languages, or an empty set if there are none
 */
public final Set<MarkupLanguage> getMarkupLanguages() {
    Set<MarkupLanguage> languages = ImmutableSet
            .copyOf(checkNotNull(loadMarkupLanguages(), "loadMarkupLanguages() must not return null")); //$NON-NLS-1$
    assertLanguageNames(languages);
    return languages;
}

From source file:com.facebook.buck.rules.TargetGroup.java

public TargetGroup(Set<BuildTarget> targets, Optional<Boolean> restrictOutboundVisibility,
        BuildTarget buildTarget) {/*from www  .ja  v a2  s .com*/
    this.buildTarget = buildTarget;
    this.targets = ImmutableSet.copyOf(targets);
    this.restrictOutboundVisibility = restrictOutboundVisibility.orElse(false);
}

From source file:org.opendaylight.yangtools.binding.data.codec.impl.UnionTypeCodec.java

private UnionTypeCodec(final Class<?> unionCls, final Set<UnionValueOptionContext> codecs) {
    super(unionCls);
    try {//from w  w w.  j  av  a 2s. c o m
        charConstructor = unionCls.getConstructor(char[].class);
        typeCodecs = ImmutableSet.copyOf(codecs);
    } catch (NoSuchMethodException | SecurityException e) {
        throw new IllegalStateException("Required constructor is not available.", e);
    }
}

From source file:ratpack.file.internal.ActivationBackedMimeTypes.java

private static Set<String> extractKnownMimeTypes() {
    try {/* w w  w  .  j  a  v a  2s.  c  o m*/
        Function<Object, String> getMimeTypeFunction = new GetMimeTypeFunction();
        Field typeHashField = makeFieldAccessible(Class.forName("com.sun.activation.registries.MimeTypeFile"),
                "type_hash");
        Field mimeTypeFilesField = makeFieldAccessible(MimetypesFileTypeMap.class, "DB");
        Object mimeTypeFiles = mimeTypeFilesField.get(MIME_TYPES_MAP);
        Set<String> mimeTypes = Sets.newHashSet();
        for (int i = 0; i < Array.getLength(mimeTypeFiles); i++) {
            Object mimeTypeFile = Array.get(mimeTypeFiles, i);
            if (mimeTypeFile != null) {
                Map<?, ?> typeHash = (Map) typeHashField.get(mimeTypeFile);
                Iterables.addAll(mimeTypes, Iterables.transform(typeHash.values(), getMimeTypeFunction));
            }
        }
        return ImmutableSet.copyOf(mimeTypes);
    } catch (ReflectiveOperationException | NullPointerException ex) {
        return ImmutableSet.of();
    }
}