List of usage examples for com.google.common.collect SetMultimap putAll
boolean putAll(Multimap<? extends K, ? extends V> multimap);
From source file:com.wrmsr.kleist.util.collect.MoreCollectors.java
public static <I, K, V> Collector<I, SetMultimap<K, V>, SetMultimap<K, V>> toHashMultimap( Function<I, K> keyMapper, Function<I, V> valueMapper) { return Collector.of(HashMultimap::create, (SetMultimap<K, V> map, I in) -> map.put(keyMapper.apply(in), valueMapper.apply(in)), (SetMultimap<K, V> left, SetMultimap<K, V> right) -> { left.putAll(right); return left; }, identity(), Collector.Characteristics.UNORDERED); }
From source file:de.fau.osr.core.db.CompositeDataSource.java
@Override protected SetMultimap<String, String> doGetAllReqCommitRelations() throws IOException { SetMultimap<String, String> result = HashMultimap.create(); for (DataSource ds : dataSources) { result.putAll(ds.getAllReqCommitRelations()); }// w w w . java 2s .c o m return result; }
From source file:org.sosy_lab.cpachecker.core.defaults.precision.LocalizedRefinablePrecision.java
@Override public VariableTrackingPrecision join(VariableTrackingPrecision consolidatedPrecision) { checkArgument(getClass().equals(consolidatedPrecision.getClass())); checkArgument(/* ww w . ja v a 2 s . com*/ super.getBaseline().equals(((LocalizedRefinablePrecision) consolidatedPrecision).getBaseline())); SetMultimap<CFANode, MemoryLocation> joinedPrec = TreeMultimap.create(rawPrecision); joinedPrec.putAll(((LocalizedRefinablePrecision) consolidatedPrecision).rawPrecision); return new LocalizedRefinablePrecision(super.getBaseline(), ImmutableMultimap.copyOf(joinedPrec)); }
From source file:org.sosy_lab.cpachecker.core.defaults.precision.LocalizedRefinablePrecision.java
@Override public LocalizedRefinablePrecision withIncrement(Multimap<CFANode, MemoryLocation> increment) { if (this.rawPrecision.entries().containsAll(increment.entries())) { return this; } else {/*w ww. j a v a2 s. c om*/ // sorted multimap so that we have deterministic output SetMultimap<CFANode, MemoryLocation> refinedPrec = TreeMultimap.create(rawPrecision); refinedPrec.putAll(increment); return new LocalizedRefinablePrecision(super.getBaseline(), ImmutableMultimap.copyOf(refinedPrec)); } }
From source file:com.facebook.buck.cli.OwnersReport.java
OwnersReport updatedWith(OwnersReport other) { SetMultimap<TargetNode<?, ?>, Path> updatedOwners = TreeMultimap.create(owners); updatedOwners.putAll(other.owners); return new OwnersReport(updatedOwners, Sets.intersection(inputsWithNoOwners, other.inputsWithNoOwners), Sets.union(nonExistentInputs, other.nonExistentInputs), Sets.union(nonFileInputs, other.nonFileInputs)); }
From source file:com.continuuity.loom.scheduler.dag.TaskDag.java
@Override public String toString() { StringBuilder output = new StringBuilder(); Comparator<TaskNode> comparator = new TaskNodeComparator(); TreeSet<TaskNode> nodes = Sets.newTreeSet(comparator); nodes.addAll(this.nodes); SetMultimap<TaskNode, TaskNode> edges = TreeMultimap.create(comparator, comparator); edges.putAll(this.edges); output.append("services:\n"); for (TaskNode node : nodes) { output.append(node);//from w w w.ja va 2 s. c o m output.append("\n"); } output.append("edges:\n"); for (TaskNode startNode : edges.keySet()) { output.append(" "); output.append(startNode); output.append("\n"); for (TaskNode endNode : edges.get(startNode)) { output.append(" -> "); output.append(endNode); output.append("\n"); } } return output.toString(); }
From source file:org.jboss.capedwarf.search.AddFieldsTask.java
protected Void execute(SetMultimap<String, Field.FieldType> map) { if (map == null) { map = HashMultimap.create();/* www .j a v a2 s .co m*/ final AdvancedCache<String, SetMultimap<String, Field.FieldType>> ac = getCache().getAdvancedCache(); ac.put(schemaName, map); } map.putAll(fields); return null; }
From source file:org.robotframework.ide.eclipse.main.plugin.model.RobotSuiteFile.java
public SetMultimap<LibrarySpecification, String> getImportedLibraries() { final Optional<RobotSettingsSection> section = findSection(RobotSettingsSection.class); final SetMultimap<String, String> toImport = HashMultimap.create(); if (section.isPresent()) { toImport.putAll(section.get().getLibrariesPathsOrNamesWithAliases()); }/*from ww w . j av a 2 s .c om*/ final SetMultimap<LibrarySpecification, String> imported = HashMultimap.create(); for (final LibrarySpecification spec : getProject().getLibrariesSpecifications()) { if (toImport.containsKey(spec.getName())) { imported.putAll(spec, toImport.get(spec.getName())); toImport.removeAll(spec.getName()); } else if (spec.isAccessibleWithoutImport()) { imported.put(spec, ""); } } for (final String toImportPathOrName : toImport.keySet()) { try { final LibrarySpecification spec = findSpecForPath(toImportPathOrName); if (spec != null) { imported.putAll(spec, toImport.get(toImportPathOrName)); } } catch (final PathResolvingException e) { // ok we won't provide any spec, since we can't resolve uri } } return imported; }
From source file:org.glowroot.transaction.model.Transaction.java
public ImmutableSetMultimap<String, String> getCustomAttributes() { if (customAttributes == null) { return ImmutableSetMultimap.of(); }/*ww w. j ava 2 s .c o m*/ SetMultimap<String, String> orderedCustomAttributes = TreeMultimap.create(String.CASE_INSENSITIVE_ORDER, String.CASE_INSENSITIVE_ORDER); synchronized (customAttributes) { orderedCustomAttributes.putAll(customAttributes); } return ImmutableSetMultimap.copyOf(orderedCustomAttributes); }
From source file:org.terasology.assets.module.ModuleWatcher.java
/** * Checks the file system for any changes that affects assets. * * @return A set of ResourceUrns of changed assets. *///from ww w. j a v a2s . com public synchronized SetMultimap<AssetType<?, ?>, ResourceUrn> checkForChanges() { if (closed) { return LinkedHashMultimap.create(); } SetMultimap<AssetType<?, ?>, ResourceUrn> changed = LinkedHashMultimap.create(); List<DelayedEvent> events = Lists.newArrayList(); unreadyEvents.drainTo(events); for (DelayedEvent event : events) { changed.putAll(event.replay()); } WatchKey key = service.poll(); while (key != null) { PathWatcher pathWatcher = pathWatchers.get(key); changed.putAll(pathWatcher.update(key.pollEvents(), Optional.of(unreadyEvents))); key.reset(); key = service.poll(); } return changed; }