List of usage examples for com.google.common.collect ImmutableMap builder
public static <K, V> Builder<K, V> builder()
From source file:org.grammaticalframework.reader.Abstract.java
public Abstract(String name, Map<String, RLiteral> _flags, AbsFun[] _absFuns, AbsCat[] _absCats) { this.name = name; flags = _flags;//from w ww .j a v a 2 s .c o m absFuns = _absFuns; absCats = _absCats; ImmutableMap.Builder<String, AbsCat> catBuilder = new ImmutableMap.Builder<String, AbsCat>(); for (AbsCat c : absCats) catBuilder.put(c.name, c); categories = catBuilder.build(); ImmutableMap.Builder<String, AbsFun> funBuilder = new ImmutableMap.Builder<String, AbsFun>(); for (AbsFun f : absFuns) funBuilder.put(f.name, f); functions = funBuilder.build(); }
From source file:org.jclouds.cloudsigma.functions.BaseDriveToMap.java
@Override public Map<String, String> apply(Drive from) { checkNotNull(from, "drive"); ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder.put("name", from.getName()); builder.put("size", from.getSize() + ""); if (from.getClaimType() != ClaimType.EXCLUSIVE) builder.put("claim:type", from.getClaimType().toString()); if (from.getTags().size() != 0) builder.put("tags", Joiner.on(' ').join(from.getTags())); if (from.getReaders().size() != 0) builder.put("readers", Joiner.on(' ').join(from.getReaders())); if (from.getUse().size() != 0) builder.put("use", Joiner.on(' ').join(from.getUse())); return builder.build(); }
From source file:com.teradata.tempto.kerberos.KerberosAuthentication.java
private static Map<String, String> createLoginOptions(String principal, String keytab) { ImmutableMap.Builder<String, String> options = ImmutableMap.builder(); options.put("useKeyTab", "true"); options.put("principal", principal); options.put("keyTab", keytab); options.put("storeKey", "true"); options.put("doNotPrompt", "true"); options.put("isInitiator", "true"); return options.build(); }
From source file:com.b2international.snowowl.snomed.api.rest.CodeSystemVersionRestRequests.java
public static ValidatableResponse createVersion(String shortName, String version, String description, String effectiveDate) {/*from w ww . j a va2s .c om*/ Map<?, ?> requestBody = ImmutableMap.builder().put("version", version).put("description", description) .put("effectiveDate", effectiveDate).build(); return givenAuthenticatedRequest(SnomedApiTestConstants.ADMIN_API).contentType(ContentType.JSON) .body(requestBody).post("/codesystems/{shortNameOrOid}/versions", shortName).then(); }
From source file:gg.uhc.uhc.util.TimeUtil.java
public static Map<TimeUnit, Long> getUnits(String timeString) { ImmutableMap.Builder<TimeUnit, Long> map = ImmutableMap.builder(); Matcher matcher = PART_PATTERN.matcher(timeString); while (matcher.find()) { String unit = matcher.group("unit").toLowerCase(); String size = matcher.group("size"); TimeUnit type = UNIT_MAP.get(unit.charAt(0)); if (type == null) continue; map.put(type, Long.parseLong(size)); }// ww w . j a va 2 s .co m return map.build(); }
From source file:org.javersion.path.Schema.java
private Schema(Builder<T> schemaBuilder, IdentityHashMap<Builder<T>, Schema<T>> schemas) { schemas.put(schemaBuilder, this); ImmutableMap.Builder<NodeId, Schema<T>> children = ImmutableMap.builder(); for (Map.Entry<NodeId, Builder<T>> entry : schemaBuilder.children.entrySet()) { Builder<T> childBuilder = entry.getValue(); Schema<T> child = schemas.get(childBuilder); if (child == null) { child = new Schema<>(childBuilder, schemas); }//w ww .java2 s . c o m children.put(entry.getKey(), child); } this.value = schemaBuilder.value; this.children = children.build(); }
From source file:org.apache.gobblin.converter.jdbc.JdbcEntrySchema.java
public JdbcEntrySchema(Iterable<JdbcEntryMetaDatum> jdbcMetaDatumEntries) { Preconditions.checkNotNull(jdbcMetaDatumEntries); ImmutableMap.Builder<String, JdbcEntryMetaDatum> builder = ImmutableSortedMap.naturalOrder(); for (JdbcEntryMetaDatum datum : jdbcMetaDatumEntries) { builder.put(datum.getColumnName(), datum); }/*from w w w. j ava 2 s .c o m*/ this.jdbcMetaData = builder.build(); }
From source file:com.lyndir.omicron.api.Level.java
@Override public ImmutableMap<Vec2, ? extends ITile> getTilesByPosition() { ImmutableMap.Builder<Vec2, ITile> builder = ImmutableBiMap.builder(); thrift().getTilesByPosition().forEach((position, tile) -> builder.put(cast(position), new Tile(tile))); return builder.build(); }
From source file:com.google.devtools.build.lib.query2.engine.AggregatingQueryExpressionVisitor.java
@Override public T visit(BinaryOperatorExpression binaryOperatorExpression) { ImmutableMap.Builder<QueryExpression, T> builder = ImmutableMap.builder(); for (QueryExpression expr : binaryOperatorExpression.getOperands()) { builder.put(expr, expr.accept(this)); }/*from w w w. j av a 2s . c om*/ return aggregate(builder.build()); }
From source file:org.apache.james.modules.objectstorage.MapConfigurationBuilder.java
public MapConfigurationBuilder() { this.config = new ImmutableMap.Builder<>(); }