List of usage examples for com.google.common.collect ImmutableMap.Builder put
public final V put(K k, V v)
From source file:com.splicemachine.orc.checkpoint.Checkpoints.java
private static Map<StreamId, StreamCheckpoint> getStructColumnCheckpoints(int column, CompressionKind compressionKind, Set<StreamKind> availableStreams, ColumnPositionsList positionsList) { ImmutableMap.Builder<StreamId, StreamCheckpoint> checkpoints = ImmutableMap.builder(); if (availableStreams.contains(PRESENT)) { checkpoints.put(new StreamId(column, PRESENT), new BooleanStreamCheckpoint(compressionKind, positionsList)); }//from w w w.j a v a 2 s .c om return checkpoints.build(); }
From source file:com.facebook.buck.go.GoDescriptors.java
private static SymlinkTree makeSymlinkTree(BuildRuleParams params, SourcePathResolver pathResolver, SourcePathRuleFinder ruleFinder, ImmutableSet<GoLinkable> linkables) { ImmutableMap.Builder<Path, SourcePath> treeMapBuilder = ImmutableMap.builder(); for (GoLinkable linkable : linkables) { for (Map.Entry<Path, SourcePath> linkInput : linkable.getGoLinkInput().entrySet()) { treeMapBuilder.put(getPathInSymlinkTree(pathResolver, linkInput.getKey(), linkInput.getValue()), linkInput.getValue()); }/*from w w w . j a v a2 s. co m*/ } ImmutableMap<Path, SourcePath> treeMap; try { treeMap = treeMapBuilder.build(); } catch (IllegalArgumentException ex) { throw new HumanReadableException(ex, "Multiple go targets have the same package name when compiling %s", params.getBuildTarget().getFullyQualifiedName()); } params = params.appendExtraDeps(ruleFinder.filterBuildRuleInputs(treeMap.values())); Path root = BuildTargets.getScratchPath(params.getProjectFilesystem(), params.getBuildTarget(), "__%s__tree"); return new SymlinkTree(params, pathResolver, root, treeMap); }
From source file:org.chaston.oakfunds.storage.RecordType.java
private static ImmutableMap<String, JdbcTypeHandler> buildTypeHandlers( ImmutableMap<String, AttributeType> attributes, @Nullable RecordType<?> parentType) { ImmutableMap.Builder<String, JdbcTypeHandler> jdbcTypeHandlers = ImmutableMap.builder(); if (parentType != null) { jdbcTypeHandlers.putAll(parentType.jdbcTypeHandlers); }//from w ww . j a va 2 s . c om for (AttributeType attributeType : attributes.values()) { jdbcTypeHandlers.put(attributeType.getName(), createJdbcTypeHandler(attributeType)); } return jdbcTypeHandlers.build(); }
From source file:org.ambraproject.rhino.util.Archive.java
public static Archive readZipFileIntoMemory(String archiveName, InputStream zipFile) throws IOException { ImmutableMap.Builder<String, byte[]> files = ImmutableMap.builder(); try (ZipInputStream zipStream = new ZipInputStream(zipFile)) { ZipEntry entry;/*from www . j a v a2 s . c o m*/ while ((entry = zipStream.getNextEntry()) != null) { byte[] fileContent = ByteStreams.toByteArray(zipStream); files.put(entry.getName(), fileContent); } } finally { zipFile.close(); } return new Archive(archiveName, files.build()) { @Override protected InputStream openFileFrom(Object fileContent) { return new ByteArrayInputStream((byte[]) fileContent); } }; }
From source file:com.facebook.buck.android.ProguardMapping.java
public static Map<String, String> readClassMapping(Iterable<String> lines) { ImmutableMap.Builder<String, String> classMappingBuilder = ImmutableMap.builder(); for (String line : lines) { if (line.charAt(0) == ' ') { // This is a member mapping, which we don't handle yet. continue; }//from ww w. j ava 2s . com Matcher matcher = CLASS_LINE_PATTERN.matcher(line); if (!matcher.matches()) { throw new IllegalArgumentException("Invalid line in proguard mapping: " + line); } classMappingBuilder.put(matcher.group(1), matcher.group(2)); } return classMappingBuilder.build(); }
From source file:com.proofpoint.jmx.MBeanRepresentation.java
private static Map<String, Object> toMap(Descriptor descriptor) { ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder(); for (String fieldName : descriptor.getFieldNames()) { Object fieldValue = descriptor.getFieldValue(fieldName); if (fieldName != null) { builder.put(fieldName, fieldValue); }//w w w .j a va 2 s. c om } ImmutableMap<String, Object> map = builder.build(); if (!map.isEmpty()) { return map; } else { return null; } }
From source file:com.splicemachine.orc.checkpoint.Checkpoints.java
private static Map<StreamId, StreamCheckpoint> getByteColumnCheckpoints(int column, CompressionKind compressionKind, Set<StreamKind> availableStreams, ColumnPositionsList positionsList) { ImmutableMap.Builder<StreamId, StreamCheckpoint> checkpoints = ImmutableMap.builder(); if (availableStreams.contains(PRESENT)) { checkpoints.put(new StreamId(column, PRESENT), new BooleanStreamCheckpoint(compressionKind, positionsList)); }/* w w w . j a v a 2 s . com*/ if (availableStreams.contains(DATA)) { checkpoints.put(new StreamId(column, DATA), new ByteStreamCheckpoint(compressionKind, positionsList)); } return checkpoints.build(); }
From source file:com.splicemachine.orc.checkpoint.Checkpoints.java
private static Map<StreamId, StreamCheckpoint> getFloatColumnCheckpoints(int column, CompressionKind compressionKind, Set<StreamKind> availableStreams, ColumnPositionsList positionsList) { ImmutableMap.Builder<StreamId, StreamCheckpoint> checkpoints = ImmutableMap.builder(); if (availableStreams.contains(PRESENT)) { checkpoints.put(new StreamId(column, PRESENT), new BooleanStreamCheckpoint(compressionKind, positionsList)); }//from w w w.ja va2s. co m if (availableStreams.contains(DATA)) { checkpoints.put(new StreamId(column, DATA), new FloatStreamCheckpoint(compressionKind, positionsList)); } return checkpoints.build(); }
From source file:com.splicemachine.orc.checkpoint.Checkpoints.java
private static Map<StreamId, StreamCheckpoint> getDoubleColumnCheckpoints(int column, CompressionKind compressionKind, Set<StreamKind> availableStreams, ColumnPositionsList positionsList) { ImmutableMap.Builder<StreamId, StreamCheckpoint> checkpoints = ImmutableMap.builder(); if (availableStreams.contains(PRESENT)) { checkpoints.put(new StreamId(column, PRESENT), new BooleanStreamCheckpoint(compressionKind, positionsList)); }/*from w w w . j ava2 s . c om*/ if (availableStreams.contains(DATA)) { checkpoints.put(new StreamId(column, DATA), new DoubleStreamCheckpoint(compressionKind, positionsList)); } return checkpoints.build(); }
From source file:com.google.devtools.build.lib.analysis.skylark.SkylarkRuleImplementationFunctions.java
/** * Builds a map: Label -> List of files from the given labels * * @param knownLabels List of known labels * @return Immutable map with immutable collections as values *//* ww w .ja va 2 s .com*/ private static ImmutableMap<Label, ImmutableCollection<Artifact>> makeLabelMap( Iterable<TransitiveInfoCollection> knownLabels) { ImmutableMap.Builder<Label, ImmutableCollection<Artifact>> builder = ImmutableMap.builder(); for (TransitiveInfoCollection current : knownLabels) { builder.put(AliasProvider.getDependencyLabel(current), ImmutableList.copyOf(current.getProvider(FileProvider.class).getFilesToBuild())); } return builder.build(); }