List of usage examples for com.google.common.collect ImmutableSetMultimap copyOf
@Beta public static <K, V> ImmutableSetMultimap<K, V> copyOf( Iterable<? extends Entry<? extends K, ? extends V>> entries)
From source file:org.gradle.internal.component.external.model.IvyDependencyMetadata.java
public IvyDependencyMetadata(ModuleVersionSelector requested, String dynamicConstraintVersion, boolean force, boolean changing, boolean transitive, Multimap<String, String> confMappings, List<Artifact> artifacts, List<Exclude> excludes) { super(requested, artifacts); this.dynamicConstraintVersion = dynamicConstraintVersion; this.force = force; this.changing = changing; this.transitive = transitive; this.confs = ImmutableSetMultimap.copyOf(confMappings); this.excludes = ImmutableList.copyOf(excludes); }
From source file:io.usethesource.criterion.impl.immutable.guava.ImmutableGuavaSetMultimap.java
@Override public JmhSetMultimap remove(JmhValue key) { final SetMultimap<JmhValue, JmhValue> tmpContent = HashMultimap.create(content); tmpContent.removeAll(key);/* w w w . j ava 2 s. com*/ final ImmutableSetMultimap<JmhValue, JmhValue> newContent = ImmutableSetMultimap.copyOf(tmpContent); return new ImmutableGuavaSetMultimap(newContent); }
From source file:org.gradle.internal.component.external.model.ivy.IvyDependencyDescriptor.java
public IvyDependencyDescriptor(ModuleComponentSelector selector, String dynamicConstraintVersion, boolean changing, boolean transitive, boolean optional, Multimap<String, String> confMappings, List<Artifact> artifacts, List<Exclude> excludes) { this.selector = selector; this.dynamicConstraintVersion = dynamicConstraintVersion; this.changing = changing; this.transitive = transitive; this.optional = optional; this.confs = ImmutableSetMultimap.copyOf(confMappings); dependencyArtifacts = ImmutableList.copyOf(artifacts); this.excludes = ImmutableList.copyOf(excludes); }
From source file:dagger.internal.codegen.MapMultibindingValidation.java
private void checkForDuplicateMapKeys(BindingNode multiboundMapBindingNode, ImmutableSet<ContributionBinding> contributions, DiagnosticReporter diagnosticReporter) { ImmutableSetMultimap<Object, ContributionBinding> contributionsByMapKey = ImmutableSetMultimap .copyOf(Multimaps.index(contributions, ContributionBinding::mapKey)); for (Set<ContributionBinding> contributionsForOneMapKey : Multimaps.asMap(contributionsByMapKey).values()) { if (contributionsForOneMapKey.size() > 1) { diagnosticReporter.reportBinding(ERROR, multiboundMapBindingNode, duplicateMapKeyErrorMessage( contributionsForOneMapKey, multiboundMapBindingNode.binding().key())); }//from w w w.ja v a 2 s. com } }
From source file:org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext.java
public EffectiveSchemaContext(final List<DeclaredStatement<?>> rootDeclaredStatements, final List<EffectiveStatement<?, ?>> rootEffectiveStatements) { this.rootDeclaredStatements = ImmutableList.copyOf(rootDeclaredStatements); this.rootEffectiveStatements = ImmutableList.copyOf(rootEffectiveStatements); Set<Module> modulesInit = new HashSet<>(); for (EffectiveStatement<?, ?> rootEffectiveStatement : rootEffectiveStatements) { if (rootEffectiveStatement instanceof ModuleEffectiveStatementImpl) { Module module = (Module) rootEffectiveStatement; modulesInit.add(module);//from w ww .ja va2s . c om } } Module[] moduleArray = new Module[modulesInit.size()]; List<Module> sortedModuleList = ModuleDependencySort.sort(modulesInit.toArray(moduleArray)); this.modules = ImmutableSet.copyOf(sortedModuleList); final SetMultimap<URI, Module> nsMap = Multimaps.newSetMultimap(new TreeMap<>(), MODULE_SET_SUPPLIER); final SetMultimap<String, Module> nameMap = Multimaps.newSetMultimap(new TreeMap<>(), MODULE_SET_SUPPLIER); Set<ModuleIdentifier> modIdBuilder = new HashSet<>(); for (Module m : modulesInit) { nameMap.put(m.getName(), m); nsMap.put(m.getNamespace(), m); modIdBuilder.add(ModuleIdentifierImpl.create(m.getName(), Optional.of(m.getNamespace()), Optional.of(m.getRevision()))); resolveSubmoduleIdentifiers(m.getSubmodules(), modIdBuilder); } namespaceToModules = ImmutableSetMultimap.copyOf(nsMap); nameToModules = ImmutableSetMultimap.copyOf(nameMap); moduleIdentifiers = ImmutableSet.copyOf(modIdBuilder); }
From source file:edu.buaa.satla.analysis.core.predicate.PredicatePrecision.java
public PredicatePrecision(Multimap<Pair<CFANode, Integer>, AbstractionPredicate> pLocationInstancePredicates, Multimap<CFANode, AbstractionPredicate> pLocalPredicates, Multimap<String, AbstractionPredicate> pFunctionPredicates, Collection<AbstractionPredicate> pGlobalPredicates) { mLocationInstancePredicates = ImmutableSetMultimap.copyOf(pLocationInstancePredicates); mLocalPredicates = sortedImmutableSetCopyOf(pLocalPredicates); mFunctionPredicates = sortedImmutableSetCopyOf(pFunctionPredicates); mGlobalPredicates = ImmutableSet.copyOf(pGlobalPredicates); }
From source file:net.minecraftforge.fml.common.discovery.ASMDataTable.java
public SetMultimap<String, ASMData> getAnnotationsFor(ModContainer container) { if (containerAnnotationData == null) { ImmutableMap.Builder<ModContainer, SetMultimap<String, ASMData>> mapBuilder = ImmutableMap .<ModContainer, SetMultimap<String, ASMData>>builder(); for (ModContainer cont : containers) { Multimap<String, ASMData> values = Multimaps.filterValues(globalAnnotationData, new ModContainerPredicate(cont)); mapBuilder.put(cont, ImmutableSetMultimap.copyOf(values)); }/*w w w . j av a 2s. com*/ containerAnnotationData = mapBuilder.build(); } return containerAnnotationData.get(container); }
From source file:com.google.devtools.moe.client.repositories.MetadataScrubber.java
/** * A utility method that is useful for stripping a list of words from all the fields of the * RevisionMetadata./*from w w w .j ava2 s. c om*/ * * @param rm the RevisionMetadata to scrub * @param words the list of words to replace * @param replacement the String to replace the target words with * @param wordAlone true if the words to match must surrounded by word boundaries * @return a copy representing the RevisionMetadata resulting from the scrub */ public static RevisionMetadata stripFromAllFields(RevisionMetadata rm, List<String> words, String replacement, boolean wordAlone) { String newId = rm.id(); String newAuthor = rm.author(); String newDescription = rm.description(); ListMultimap<String, String> newFields = LinkedListMultimap.create(rm.fields()); for (String word : words) { String regex = (wordAlone) ? ("(?i)(\\b)" + word + "(\\b)") : ("(?i)" + word); newId = newId.replaceAll(regex, replacement); newAuthor = replaceAuthor(newAuthor, word, replacement); newDescription = newDescription.replaceAll(regex, replacement); for (Entry<String, String> entry : newFields.entries()) { entry.setValue(entry.getValue().replaceAll(regex, replacement)); } } return rm.toBuilder().id(newId).author(newAuthor).description(newDescription) .fields(ImmutableSetMultimap.copyOf(newFields)).build(); }
From source file:com.mgmtp.perfload.core.client.web.template.RequestTemplate.java
/** * @param type/* w w w . j a va 2 s .c o m*/ * The type of the request * @param uri * The context-relativ URL (i. e. the pathinfo part of the URL) without the query * string * @param uriAlias * an alias for the URI used for logging measurings * @param requestParameters * A {@link SetMultimap} of request parameters * @param detailExtractions * A map of details extractions */ public RequestTemplate(final String type, final String skip, final String uri, final String uriAlias, final SetMultimap<String, String> requestHeaders, final SetMultimap<String, String> requestParameters, final Body body, final List<HeaderExtraction> headerExtractions, final List<DetailExtraction> detailExtractions, final String validateResponse) { checkArgument(type != null, "Parameter 'type' must not be null."); checkArgument(uri != null, "Parameter 'uri' must not be null."); checkArgument(requestHeaders != null, "Parameter 'requestHeaders' must not be null."); checkArgument(requestParameters != null, "Parameter 'requestParameters' must not be null."); checkArgument(headerExtractions != null, "Parameter 'headerExtractions' must not be null."); checkArgument(detailExtractions != null, "Parameter 'detailExtractions' must not be null."); this.type = type; this.skip = skip; this.uri = uri; this.uriAlias = uriAlias; this.requestHeaders = ImmutableSetMultimap.copyOf(requestHeaders); this.requestParameters = ImmutableSetMultimap.copyOf(requestParameters); this.body = body; this.headerExtractions = ImmutableList.copyOf(headerExtractions); this.detailExtractions = ImmutableList.copyOf(detailExtractions); this.validateResponse = validateResponse; }
From source file:org.sosy_lab.cpachecker.util.VariableClassification.java
VariableClassification(boolean pHasRelevantNonIntAddVars, Set<String> pIntBoolVars, Set<String> pIntEqualVars, Set<String> pIntAddVars, Set<String> pRelevantVariables, Set<String> pAddressedVariables, Multimap<CCompositeType, String> pRelevantFields, Collection<Partition> pPartitions, Set<Partition> pIntBoolPartitions, Set<Partition> pIntEqualPartitions, Set<Partition> pIntAddPartitions, Map<Pair<CFAEdge, Integer>, Partition> pEdgeToPartitions) { hasRelevantNonIntAddVars = pHasRelevantNonIntAddVars; intBoolVars = ImmutableSet.copyOf(pIntBoolVars); intEqualVars = ImmutableSet.copyOf(pIntEqualVars); intAddVars = ImmutableSet.copyOf(pIntAddVars); relevantVariables = ImmutableSet.copyOf(pRelevantVariables); addressedVariables = ImmutableSet.copyOf(pAddressedVariables); relevantFields = ImmutableSetMultimap.copyOf(pRelevantFields); partitions = ImmutableSet.copyOf(pPartitions); intBoolPartitions = ImmutableSet.copyOf(pIntBoolPartitions); intEqualPartitions = ImmutableSet.copyOf(pIntEqualPartitions); intAddPartitions = ImmutableSet.copyOf(pIntAddPartitions); edgeToPartitions = ImmutableMap.copyOf(pEdgeToPartitions); }