List of usage examples for com.google.common.collect ImmutableMultimap builder
public static <K, V> Builder<K, V> builder()
From source file:com.facebook.buck.android.AndroidAppModularity.java
@Override public ImmutableList<Step> getBuildSteps(BuildContext buildContext, BuildableContext buildableContext) { ImmutableList.Builder<Step> steps = ImmutableList.builder(); Path metadataFile = buildContext.getSourcePathResolver().getRelativePath(getSourcePathToOutput()); steps.add(MkdirStep.of(BuildCellRelativePath.fromCellRelativePath(buildContext.getBuildCellRootPath(), getProjectFilesystem(), metadataFile.getParent()))); ImmutableMultimap.Builder<APKModule, Path> additionalDexStoreToJarPathMapBuilder = ImmutableMultimap .builder();// w ww . j av a 2 s .c o m additionalDexStoreToJarPathMapBuilder .putAll(result.getPackageableCollection().getModuleMappedClasspathEntriesToDex().entries().stream() .map(input -> new AbstractMap.SimpleEntry<>(input.getKey(), getProjectFilesystem().relativize( buildContext.getSourcePathResolver().getAbsolutePath(input.getValue())))) .collect(ImmutableSet.toImmutableSet())); ImmutableMultimap<APKModule, Path> additionalDexStoreToJarPathMap = additionalDexStoreToJarPathMapBuilder .build(); steps.add(WriteAppModuleMetadataStep.writeModuleMetadata(metadataFile, additionalDexStoreToJarPathMap, result.getAPKModuleGraph(), getProjectFilesystem(), Optional.empty(), Optional.empty(), /*skipProguard*/ true)); buildableContext.recordArtifact(metadataFile); return steps.build(); }
From source file:org.javersion.store.jdbc.DocumentVersionStoreJdbc.java
public void append(Id docId, Iterable<VersionNode<PropertyPath, Object, M>> versions) { options.transactions.writeRequired(() -> { ImmutableMultimap.Builder<Id, VersionNode<PropertyPath, Object, M>> builder = ImmutableMultimap .builder();//from w ww.j ava 2 s .c o m doAppend(builder.putAll(docId, versions).build()); return null; }); }
From source file:com.github.nmorel.gwtjackson.guava.client.deser.ImmutableMultimapJsonDeserializer.java
@Override protected ImmutableMultimap<K, V> doDeserialize(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params) { ImmutableMultimap.Builder<K, V> builder = ImmutableMultimap.builder(); buildMultimap(reader, ctx, params, builder); return builder.build(); }
From source file:co.paralleluniverse.comsat.webactors.netty.HttpRequestWrapper.java
@Override public Multimap<String, String> getParameters() { QueryStringDecoder queryStringDecoder; if (params == null) { queryStringDecoder = new QueryStringDecoder(req.getUri()); final ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder(); final Map<String, List<String>> parameters = queryStringDecoder.parameters(); for (final String k : parameters.keySet()) builder.putAll(k, parameters.get(k)); params = builder.build();//w ww.j a v a 2s . c o m } return params; }
From source file:com.ning.arecibo.dashboard.resources.HostsStore.java
private void start() { service.scheduleWithFixedDelay(new Runnable() { @Override//w w w. j ava 2 s. c o m public void run() { final ImmutableMultimap.Builder<String, Map<String, String>> builder = new ImmutableMultimap.Builder<String, Map<String, String>>(); final Iterable<String> hosts = client.getHosts(); for (final String hostName : hosts) { final String coreType = Strings.nullToEmpty(galaxyStatusManager.getCoreType(hostName)); builder.put(coreType, ImmutableMap.<String, String>of("hostName", hostName, "globalZone", Strings.nullToEmpty(galaxyStatusManager.getGlobalZone(hostName)), "configPath", Strings.nullToEmpty(galaxyStatusManager.getConfigPath(hostName)), "configSubPath", Strings.nullToEmpty(galaxyStatusManager.getConfigSubPath(hostName)), "coreType", coreType)); } updateCacheIfNeeded(builder.build()); } }, config.getSampleKindsUpdaterDelay().getMillis(), config.getSampleKindsUpdaterDelay().getMillis(), TimeUnit.MILLISECONDS); // We give an initial delay for the Galaxy manager to query the Gonsole first Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { service.shutdownNow(); } }); }
From source file:com.isotrol.impe3.core.impl.RequestParamsFactory.java
/** * Returns the collection of request parameters from a multimap object. * @param map Multimap./*from w ww. j a v a2 s . c o m*/ * @return The request query parameters. */ public static RequestParams of(Multimap<String, String> map) { if (map == null || map.isEmpty()) { return EMPTY; } final ImmutableMultimap.Builder<CaseIgnoringString, String> builder = ImmutableMultimap.builder(); for (String key : map.keySet()) { final CaseIgnoringString cis = CaseIgnoringString.valueOf(key); builder.putAll(cis, map.get(key)); } return new Immutable(builder.build()); }
From source file:org.sosy_lab.cpachecker.cpa.loopstack.LoopstackTransferRelation.java
public LoopstackTransferRelation(int maxLoopIterations, CFA pCfa) throws InvalidCFAException { this.maxLoopIterations = maxLoopIterations; if (!pCfa.getLoopStructure().isPresent()) { throw new InvalidCFAException("LoopstackCPA does not work without loop information!"); }//from w w w . j av a 2 s .com LoopStructure loops = pCfa.getLoopStructure().get(); ImmutableMap.Builder<CFAEdge, Loop> entryEdges = ImmutableMap.builder(); ImmutableMap.Builder<CFAEdge, Loop> exitEdges = ImmutableMap.builder(); ImmutableMultimap.Builder<CFANode, Loop> heads = ImmutableMultimap.builder(); for (Loop l : loops.getAllLoops()) { // function edges do not count as incoming/outgoing edges Iterable<CFAEdge> incomingEdges = filter(l.getIncomingEdges(), not(instanceOf(CFunctionReturnEdge.class))); Iterable<CFAEdge> outgoingEdges = filter(l.getOutgoingEdges(), not(instanceOf(CFunctionCallEdge.class))); for (CFAEdge e : incomingEdges) { entryEdges.put(e, l); } for (CFAEdge e : outgoingEdges) { exitEdges.put(e, l); } for (CFANode h : l.getLoopHeads()) { heads.put(h, l); } } loopEntryEdges = entryEdges.build(); loopExitEdges = exitEdges.build(); loopHeads = heads.build(); }
From source file:org.jclouds.s3.options.PutObjectOptions.java
@Override public Multimap<String, String> buildRequestHeaders() { checkState(headerTag != null, "headerTag should have been injected!"); ImmutableMultimap.Builder<String, String> returnVal = ImmutableMultimap.builder(); for (Entry<String, String> entry : headers.entries()) { returnVal.put(entry.getKey().replace(DEFAULT_AMAZON_HEADERTAG, headerTag), entry.getValue()); }/*w w w.j a v a 2 s. c o m*/ return returnVal.build(); }
From source file:com.vecna.dbDiff.model.relationalDb.RelationalTable.java
/** * Set the indices.//w w w .j a v a 2s . c o m * @param indices The indices to set * @throws InconsistentSchemaException If adding an index not recognized by the current table */ public void setIndices(List<RelationalIndex> indices) throws InconsistentSchemaException { ImmutableMultimap.Builder<List<String>, RelationalIndex> indexMapBuilder = ImmutableListMultimap.builder(); if (getName() == null) { throw new InconsistentSchemaException("Trying to add indices without setting a table!"); } else { for (RelationalIndex ri : indices) { if (!getCatalogSchema().equals(ri.getCatalogSchema())) { throw new InconsistentSchemaException("Index " + ri.getName() + " and table " + getName() + " belong to different catalogs or schemas."); } indexMapBuilder.put(ri.getColumnNames(), ri); } } m_indicesByColumns = indexMapBuilder.build(); }
From source file:com.outerspacecat.icalendar.Component.java
/** * Creates a new component./*w w w.j ava 2 s .c o m*/ * * @param name the component name. Must be non {@code null} and return * {@code true} for {@link #isValidName(CharSequence)}. * @param properties the component properties. Must be non {@code null} and * all elements must be non {@code null}. * @param components the component sub-components. Must be non {@code null} * and all elements must be non {@code null}. */ public Component(final CharSequence name, final Iterable<Property> properties, final Iterable<Component> components) { Preconditions.checkNotNull(name, "name required"); Preconditions.checkArgument(isValidName(name.toString().toUpperCase()), "invalid name: " + name); Preconditions.checkNotNull(properties, "properties required"); Preconditions.checkNotNull(components, "components required"); this.name = name.toString().toUpperCase(); ImmutableMultimap.Builder<String, Property> propBuilder = new ImmutableMultimap.Builder<String, Property>(); for (Property prop : properties) { Preconditions.checkNotNull(prop, "properties must each be non null"); propBuilder.put(prop.getName().getName(), prop); } this.properties = propBuilder.build(); ImmutableMultimap.Builder<String, Component> compBuilder = new ImmutableMultimap.Builder<String, Component>(); for (Component comp : components) { Preconditions.checkNotNull(comp, "components must each be non null"); compBuilder.put(comp.getName(), comp); } this.components = compBuilder.build(); }