List of usage examples for com.google.common.collect ImmutableMap.Builder put
public final V put(K k, V v)
From source file:com.google.security.zynamics.binnavi.disassembly.types.BaseTypeCategory.java
private static ImmutableMap<String, BaseTypeCategory> createLookup() { final ImmutableMap.Builder<String, BaseTypeCategory> builder = ImmutableMap.builder(); for (final BaseTypeCategory category : BaseTypeCategory.values()) { builder.put(category.value, category); }//ww w . j a v a2 s. co m return builder.build(); }
From source file:com.github.errantlinguist.latticevisualiser.StatePaintTransformer.java
/** * /* w w w . ja v a 2 s . c om*/ * @return A map of {@link StateType StateTypes} to {@link Color Colors} for * deriving the colour used to draw the vertex representing a state. */ static final ImmutableMap<StateType, Color> makeColorMap() { final ImmutableMap.Builder<StateType, Color> builder = ImmutableMap.builder(); builder.put(StateType.INITIAL, Color.CYAN); builder.put(StateType.FINAL, Color.MAGENTA); builder.put(StateType.GOAL, Color.RED); builder.put(StateType.INTERMEDIATE, Color.GREEN); return builder.build(); }
From source file:com.facebook.buck.apple.AppleLibraryDescriptionSwiftEnhancer.java
public static ImmutableMap<Path, SourcePath> getObjCGeneratedHeader(BuildTarget buildTarget, ActionGraphBuilder graphBuilder, CxxPlatform cxxPlatform, HeaderVisibility headerVisibility) { BuildTarget swiftCompileTarget = createBuildTargetForSwiftCompile(buildTarget, cxxPlatform); SwiftCompile compile = (SwiftCompile) graphBuilder.requireRule(swiftCompileTarget); Path objCImportPath = getObjCGeneratedHeaderSourceIncludePath(headerVisibility, compile); SourcePath objCGeneratedPath = compile.getObjCGeneratedHeaderPath(); ImmutableMap.Builder<Path, SourcePath> headerLinks = ImmutableMap.builder(); headerLinks.put(objCImportPath, objCGeneratedPath); return headerLinks.build(); }
From source file:com.google.template.soy.shared.internal.InternalPlugins.java
public static ImmutableMap<String, SoyFunction> internalLegacyFunctionMap() { ImmutableMap.Builder<String, SoyFunction> builder = ImmutableMap.builder(); for (String builtinFunctionName : BuiltinFunction.names()) { builder.put(builtinFunctionName, BuiltinFunction.forFunctionName(builtinFunctionName)); }/*from ww w .java 2 s . c o m*/ return builder.build(); }
From source file:org.apache.gobblin.util.PropertiesUtils.java
/** * Converts a {@link Properties} object to a {@link Map} where each key is a {@link String}. *//*from ww w .ja v a 2s. com*/ public static Map<String, ?> propsToStringKeyMap(Properties properties) { ImmutableMap.Builder<String, Object> mapBuilder = ImmutableMap.builder(); for (Map.Entry<Object, Object> entry : properties.entrySet()) { mapBuilder.put(entry.getKey().toString(), entry.getValue()); } return mapBuilder.build(); }
From source file:org.jetbrains.jet.lang.resolve.java.kotlinSignature.JavaToKotlinMethodMap.java
private static ImmutableMap<String, String> pairs2Map(Pair<String, String>[] pairs) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); for (Pair<String, String> pair : pairs) { builder.put(pair.first, pair.second); }//from w w w. ja v a 2 s . c o m return builder.build(); }
From source file:com.google.javascript.jscomp.newtypes.TypeParameters.java
static TypeParameters make(List<String> ordinaryTypeParams, Map<String, Node> ttlParams) { ImmutableMap.Builder<String, Node> builder = ImmutableMap.builder(); for (String typeParam : ordinaryTypeParams) { builder.put(typeParam, IR.empty()); }//from w ww . j a va 2 s. co m builder.putAll(ttlParams); return new TypeParameters(builder.build()); }
From source file:google.registry.monitoring.whitebox.EppMetric.java
/** * Helper method to populate an {@link com.google.common.collect.ImmutableMap.Builder} with an * {@link Optional} value if the value is {@link Optional#isPresent()}. *///from w w w . j a va 2 s. co m private static <T> void addOptional(String key, Optional<T> value, ImmutableMap.Builder<String, String> map) { if (value.isPresent()) { map.put(key, value.get().toString()); } }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3AnnotationDiffSimplePrinter.java
/** * Converts an {@link ImmutableList} of {@link Ds3AnnotationElement} into an {@link ImmutableMap} of * annotation names and {@link Ds3AnnotationElement} *//* ww w. j ava 2 s . c om*/ private static ImmutableMap<String, Ds3AnnotationElement> toAnnotationElementMap( final ImmutableList<Ds3AnnotationElement> elements) { if (isEmpty(elements)) { return ImmutableMap.of(); } final ImmutableMap.Builder<String, Ds3AnnotationElement> builder = ImmutableMap.builder(); elements.forEach(element -> builder.put(element.getName(), element)); return builder.build(); }
From source file:com.b2international.snowowl.snomed.importer.release.ReleaseFileSetSelectors.java
private static ReleaseFileSet createSnapshotReleaseFileSet(final String terminologyRoot, final String refSetRoot, final String languageRefSetRoot, final boolean includesStatedRelationships, final boolean testRelease, final List<String> refSetPaths) { final ImmutableMap.Builder<ReleaseComponentType, ReleaseFile> componentMapBuilder = ImmutableMap.builder(); componentMapBuilder.put(ReleaseComponentType.CONCEPT, new SimpleReleaseFile(terminologyRoot, SimpleReleaseComponentType.CONCEPT)); componentMapBuilder.put(ReleaseComponentType.RELATIONSHIP, new SimpleReleaseFile(terminologyRoot, SimpleReleaseComponentType.RELATIONSHIP)); componentMapBuilder.put(ReleaseComponentType.DESCRIPTION, new DescriptionReleaseFile(terminologyRoot)); componentMapBuilder.put(ReleaseComponentType.LANGUAGE_REFERENCE_SET, new LanguageRefsetReleaseFile(languageRefSetRoot)); componentMapBuilder.put(ReleaseComponentType.TEXT_DEFINITION, new TextDefinitionReleaseFile(terminologyRoot)); if (includesStatedRelationships) { componentMapBuilder.put(ReleaseComponentType.STATED_RELATIONSHIP, new SimpleReleaseFile(terminologyRoot, SimpleReleaseComponentType.STATEDRELATIONSHIP)); }//from ww w. ja va 2 s. c om return new ReleaseFileSet(testRelease, componentMapBuilder.build(), refSetPaths); }