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.drive.sumo.LaneMapper.java

public List<MeasurePoint> buildMeasurePoints(Repository<InductionLoop> repo,
        Consumer<MeasurePoint.Data> dataConsumer) throws IOException {

    Map<String, List<InductionLoop>> groups = repo.getAll().values().stream().collect(groupingBy(il -> {
        String id = il.getID();//ww w.ja va 2 s . c om
        return id.substring(4, id.length() - 2);
    }));

    return groups.entrySet().stream().map(e -> new MeasurePoint(dataConsumer, ImmutableSet.copyOf(e.getValue()),
            sumoToAlgoEdgeIdMap.get(e.getKey()))).collect(toList());
}

From source file:com.opengamma.engine.marketdata.availability.DomainMarketDataAvailabilityFilter.java

/**
 * Creates a provider./* ww  w.  j  a  v  a 2s.c  om*/
 * 
 * @param acceptableSchemes the acceptable schemes, not null
 * @param validMarketDataRequirementNames the valid market data requirement names, not null
 */
public DomainMarketDataAvailabilityFilter(final Collection<ExternalScheme> acceptableSchemes,
        final Collection<String> validMarketDataRequirementNames) {
    super(validMarketDataRequirementNames);
    ArgumentChecker.notNull(acceptableSchemes, "acceptableSchemes");
    _acceptableSchemes = ImmutableSet.copyOf(acceptableSchemes);
}

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

/**
 * Returns a MapReduce {@link Input} that loads all {@link EppResource} objects of a given type,
 * including deleted resources.//  w w  w. ja va 2 s.co  m
 *
 * <p>Note: Do not concatenate multiple EntityInputs together (this is inefficient as it iterates
 * through all buckets multiple times). Specify the types in a single input, or load all types by
 * specifying {@link EppResource} as the class.
 */
@SafeVarargs
public static <R extends EppResource> Input<R> createEntityInput(Class<? extends R> resourceClass,
        Class<? extends R>... moreResourceClasses) {
    return new EppResourceEntityInput<R>(ImmutableSet.copyOf(asList(resourceClass, moreResourceClasses)));
}

From source file:com.google.idea.blaze.base.model.primitives.WorkspaceType.java

WorkspaceType(String name, LanguageClass... languages) {
    this.name = name;
    this.languages = ImmutableSet.copyOf(languages);
}

From source file:org.onosproject.cluster.ClusterMetadataDiff.java

public ClusterMetadataDiff(ClusterMetadata oldValue, ClusterMetadata newValue) {
    this.oldValue = oldValue;
    this.newValue = newValue;

    Set<ControllerNode> currentNodeSet = oldValue == null ? ImmutableSet.of()
            : ImmutableSet.copyOf(oldValue.getNodes());
    Set<ControllerNode> newNodeSet = newValue == null ? ImmutableSet.of()
            : ImmutableSet.copyOf(newValue.getNodes());
    nodesAdded = Sets.difference(newNodeSet, currentNodeSet);
    nodesRemoved = Sets.difference(currentNodeSet, newNodeSet).stream().map(ControllerNode::id)
            .collect(Collectors.toSet());
}

From source file:ru.codeinside.adm.ui.employee.TableEmployee.java

static public OptionGroup createRoleOptionGroup(String caption) {
    final OptionGroup roles = new OptionGroup(caption, ImmutableSet.copyOf(Role.values()));
    for (final Role role : Role.values()) {
        roles.setItemCaption(role, role.description);
    }/*from   ww  w  .  ja  v  a2  s  . c o  m*/
    roles.setMultiSelect(true);
    roles.setNullSelectionAllowed(true);
    roles.setImmediate(true);
    return roles;
}

From source file:io.scigraph.annotation.Entity.java

public Entity(Iterable<String> terms, String id, Iterable<String> categories) {
    this.term = ImmutableSet.copyOf(terms);
    this.id = id;
    this.categories = ImmutableSet.copyOf(categories);
}

From source file:org.sosy_lab.cpachecker.cfa.blocks.Block.java

public Block(Set<ReferencedVariable> pReferencedVariables, Set<CFANode> pCallNodes, Set<CFANode> pReturnNodes,
        Set<CFANode> allNodes) {

    referencedVariables = ImmutableSet.copyOf(pReferencedVariables);
    callNodes = ImmutableSet.copyOf(pCallNodes);
    returnNodes = ImmutableSet.copyOf(pReturnNodes);
    nodes = ImmutableSet.copyOf(allNodes);
}

From source file:com.eviware.loadui.util.serialization.ListenableValueSupport.java

public void update(T newValue) {
    lastValue = newValue;/*from   ww w.j ava 2 s  .c  o m*/

    for (ListenableValue.ValueListener<? super T> listener : ImmutableSet.copyOf(listeners)) {
        listener.update(newValue);
    }
}

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

public InstanceBindingImpl(Injector injector, Key<T> key, Object source,
        InternalFactory<? extends T> internalFactory, Set<InjectionPoint> injectionPoints, T instance) {
    super(injector, key, source, internalFactory, Scoping.UNSCOPED);
    this.injectionPoints = ImmutableSet.copyOf(injectionPoints);
    this.instance = instance;
    this.provider = Providers.of(instance);
}