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.testing.compile.TypeEnumerator.java

/**
 * Returns a set of strings containing the fully qualified names of all
 * the types that are declared by the given CompilationUnitTree
 *///from  w w w  .ja  va 2 s.  com
static ImmutableSet<String> getTopLevelTypes(CompilationUnitTree t) {
    return ImmutableSet.copyOf(nameVisitor.scan(t, null));
}

From source file:io.prestosql.sql.planner.assertions.StrictSymbolsMatcher.java

public static Function<PlanNode, Set<Symbol>> actualOutputs() {
    return node -> ImmutableSet.copyOf(node.getOutputSymbols());
}

From source file:org.onosproject.store.consistent.impl.DatabaseDefinition.java

/**
 * Creates a new DatabaseDefinition./*from   w w w. j  av a 2 s .c o  m*/
 *
 * @param partitions partition map
 * @param nodes      set of nodes
 * @return database definition
 */
public static DatabaseDefinition from(Map<String, Set<NodeInfo>> partitions, Set<NodeInfo> nodes) {
    checkNotNull(partitions);
    checkNotNull(nodes);
    DatabaseDefinition definition = new DatabaseDefinition();
    definition.partitions = ImmutableMap.copyOf(partitions);
    definition.nodes = ImmutableSet.copyOf(nodes);
    return definition;
}

From source file:com.axemblr.service.cm.models.events.EventAttribute.java

@JsonCreator
public EventAttribute(@JsonProperty("name") String name, @JsonProperty("values") Set<String> values) {
    this.name = name;
    this.values = (values == null) ? ImmutableSet.<String>of() : ImmutableSet.copyOf(values);
}

From source file:com.axemblr.service.cm.models.users.UserList.java

@JsonCreator
public UserList(@JsonProperty("items") Set<User> items) {
    this.items = (items == null) ? ImmutableSet.<User>of() : ImmutableSet.copyOf(items);
}

From source file:org.eclipse.buildship.core.workspace.GradleNatureAddedEvent.java

public GradleNatureAddedEvent(Set<IProject> projects) {
    this.projects = ImmutableSet.copyOf(projects);
}

From source file:com.ibm.og.cli.util.IntegerSetConverter.java

public Set<Integer> convert(String value) {
    SortedSet<Integer> set = new TreeSet<Integer>();
    String[] values = value.split(",");
    for (String num : values) {
        set.add(Integer.parseInt(num));
    }//from  w w w .  j av a  2  s.  com
    return ImmutableSet.copyOf(set);
}

From source file:com.axemblr.service.cm.models.cm.RoleList.java

@JsonCreator
public RoleList(@JsonProperty("items") Set<Role> items) {
    this.items = (items == null) ? ImmutableSet.<Role>of() : ImmutableSet.copyOf(items);
}

From source file:io.prestosql.sql.planner.iterative.rule.Util.java

/**
 * Prune the set of available inputs to those required by the given expressions.
 * <p>//from w  ww .  j  a  va  2  s  . c o  m
 * If all inputs are used, return Optional.empty() to indicate that no pruning is necessary.
 */
public static Optional<Set<Symbol>> pruneInputs(Collection<Symbol> availableInputs,
        Collection<Expression> expressions) {
    Set<Symbol> availableInputsSet = ImmutableSet.copyOf(availableInputs);
    Set<Symbol> prunedInputs = Sets.filter(availableInputsSet,
            SymbolsExtractor.extractUnique(expressions)::contains);

    if (prunedInputs.size() == availableInputsSet.size()) {
        return Optional.empty();
    }

    return Optional.of(prunedInputs);
}

From source file:dagger.internal.codegen.SpiModule.java

private static ImmutableSet<BindingGraphPlugin> loadPlugins() {
    return ImmutableSet
            .copyOf(ServiceLoader.load(BindingGraphPlugin.class, BindingGraphPlugins.class.getClassLoader()));
}