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.onosproject.net.resource.DiscreteResourceSet.java

/**
 * Creates an instance with resources and the codec for them.
 *
 * @param values resources to be contained in the instance
 * @param codec codec for the specified resources
 * @return an instance//w  w  w .  j  a  v a 2  s .  c  o m
 */
public static DiscreteResourceSet of(Set<DiscreteResource> values, DiscreteResourceCodec codec) {
    checkNotNull(values);
    checkNotNull(codec);
    checkArgument(!values.isEmpty());

    return new DiscreteResourceSet(ImmutableSet.copyOf(values), codec);
}

From source file:grakn.core.graql.gremlin.spanningtree.graph.SparseWeightedGraph.java

public static SparseWeightedGraph from(Iterable<Node> nodes, Iterable<Weighted<DirectedEdge>> edges) {
    final Map<Node, Map<Node, Weighted<DirectedEdge>>> incomingEdges = Maps.newHashMap();
    for (Weighted<DirectedEdge> edge : edges) {
        if (!incomingEdges.containsKey(edge.val.destination)) {
            incomingEdges.put(edge.val.destination, Maps.newHashMap());
        }/*from w ww. ja  v  a 2  s.com*/
        incomingEdges.get(edge.val.destination).put(edge.val.source, edge);
    }
    return new SparseWeightedGraph(ImmutableSet.copyOf(nodes), incomingEdges);
}

From source file:com.cathive.sass.constraints.ScssFileValidation.java

/**
 * Changes the contents of the file extensions that can be used for SCSS files.
 * @param allowedFileExtensions//w  ww .j  a  va 2s .  c o  m
 *     File extensions that can be used for SCSS files.
 */
public static void setAllowedFileExtensions(@Nonnull final Set<String> allowedFileExtensions) {
    ALLOWED_FILE_EXTENSIONS = ImmutableSet.copyOf(allowedFileExtensions);
}

From source file:org.mule.module.extension.internal.introspection.AbstractCapableDescribed.java

AbstractCapableDescribed(String name, String description, Set<Object> capabilities) {
    super(name, description);
    this.capabilities = capabilities != null ? ImmutableSet.copyOf(capabilities) : ImmutableSet.of();
}

From source file:co.cask.cdap.api.security.ACL.java

public ACL(Principal principal, Iterable<PermissionType> permissions) {
    this.principal = principal;
    this.permissions = ImmutableSet.copyOf(permissions);
}

From source file:org.onosproject.segmentrouting.MockHostService.java

MockHostService(Set<Host> hosts) {
    this.hosts = ImmutableSet.copyOf(hosts);
}

From source file:org.trancecode.xml.saxon.SaxonPredicates.java

public static Predicate<XdmNode> hasNodeKind(final Iterable<XdmNodeKind> nodeKinds) {
    return Predicates.compose(TcPredicates.isContainedBy(ImmutableSet.copyOf(nodeKinds)),
            SaxonFunctions.getNodeKind());
}

From source file:org.mule.module.extension.internal.introspection.AbstractImmutableCapableDescribed.java

AbstractImmutableCapableDescribed(String name, String description, Set<Object> capabilities) {
    super(name, description);
    this.capabilities = capabilities != null ? ImmutableSet.copyOf(capabilities) : ImmutableSet.of();
}

From source file:com.google.caliper.bridge.DryRunRequest.java

public DryRunRequest(Iterable<ExperimentSpec> experiments) {
    this.experiments = ImmutableSet.copyOf(experiments);
}

From source file:com.google.idea.blaze.base.run.testlogs.BlazeCommandLogParser.java

@VisibleForTesting
static ImmutableSet<Label> parseTestTargets(Stream<String> lines) {
    return ImmutableSet.copyOf(lines.map(BlazeCommandLogParser::parseTestTarget).filter(Objects::nonNull)
            .collect(Collectors.toSet()));
}