Tabnine Logo
ImmutableMap.builder
Code IndexAdd Tabnine to your IDE (free)

How to use
builder
method
in
com.google.common.collect.ImmutableMap

Best Java code snippets using com.google.common.collect.ImmutableMap.builder (Showing top 20 results out of 13,797)

Refine searchRefine arrow

  • ImmutableMap.Builder.build
  • ImmutableMap.Builder.put
  • Map.Entry.getKey
  • Map.Entry.getValue
  • Map.entrySet
origin: google/guava

 @Override
 protected Map<String, String> create(Entry<String, String>[] entries) {
  ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
  for (Entry<String, String> entry : entries) {
   builder.put(entry.getKey(), entry.getValue());
  }
  return builder.build();
 }
}
origin: google/guava

/** Returns a new {@code TypeResolver} with {@code variable} mapping to {@code type}. */
final TypeTable where(Map<TypeVariableKey, ? extends Type> mappings) {
 ImmutableMap.Builder<TypeVariableKey, Type> builder = ImmutableMap.builder();
 builder.putAll(map);
 for (Entry<TypeVariableKey, ? extends Type> mapping : mappings.entrySet()) {
  TypeVariableKey variable = mapping.getKey();
  Type type = mapping.getValue();
  checkArgument(!variable.equalsType(type), "Type variable %s bound to itself", variable);
  builder.put(variable, type);
 }
 return new TypeTable(builder.build());
}
origin: prestodb/presto

private Map<Symbol, Integer> createJoinSourcesLayout(Map<Symbol, Integer> lookupSourceLayout, Map<Symbol, Integer> probeSourceLayout)
{
  Builder<Symbol, Integer> joinSourcesLayout = ImmutableMap.builder();
  joinSourcesLayout.putAll(lookupSourceLayout);
  for (Map.Entry<Symbol, Integer> probeLayoutEntry : probeSourceLayout.entrySet()) {
    joinSourcesLayout.put(probeLayoutEntry.getKey(), probeLayoutEntry.getValue() + lookupSourceLayout.size());
  }
  return joinSourcesLayout.build();
}
origin: google/guava

 @Override
 public Collection<UnhashableObject> create(UnhashableObject[] elements) {
  ImmutableMap.Builder<Integer, UnhashableObject> builder = ImmutableMap.builder();
  int key = 1;
  for (UnhashableObject value : elements) {
   builder.put(key++, value);
  }
  return builder.build().values();
 }
}
origin: prestodb/presto

  @JsonProperty
  public synchronized Map<String, Double> getRecentFailuresByType()
  {
    ImmutableMap.Builder<String, Double> builder = ImmutableMap.builder();
    for (Map.Entry<Class<? extends Throwable>, DecayCounter> entry : failureCountByType.entrySet()) {
      builder.put(entry.getKey().getName(), entry.getValue().getCount());
    }
    return builder.build();
  }
}
origin: google/guava

 @Override
 public List<Entry<String, Integer>> create(Object... elements) {
  ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
  for (Object o : elements) {
   @SuppressWarnings("unchecked")
   Entry<String, Integer> entry = (Entry<String, Integer>) o;
   builder.put(entry);
  }
  return builder.build().entrySet().asList();
 }
}
origin: dreamhead/moco

public static Map<String, String> arrayValueToSimple(final Map<String, String[]> map) {
  ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
  for (Map.Entry<String, String[]> entry : map.entrySet()) {
    builder.put(entry.getKey(), entry.getValue()[0]);
  }
  return builder.build();
}
origin: google/guava

 @Override
 public List<String> create(String[] elements) {
  ImmutableMap.Builder<Integer, String> builder = ImmutableMap.builder();
  for (int i = 0; i < elements.length; i++) {
   builder.put(i, elements[i]);
  }
  return builder.build().values().asList();
 }
}
origin: dreamhead/moco

public static Map<String, String[]> simpleValueToArray(final Map<String, String> map) {
  ImmutableMap.Builder<String, String[]> builder = ImmutableMap.builder();
  for (Map.Entry<String, String> entry : map.entrySet()) {
    builder.put(entry.getKey(), new String[]{entry.getValue()});
  }
  return builder.build();
}
origin: google/guava

 @Override
 public List<String> create(String[] elements) {
  ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
  for (int i = 0; i < elements.length; i++) {
   builder.put(elements[i], i);
  }
  return builder.build().keySet().asList();
 }
}
origin: dreamhead/moco

public static Map<String, String[]> iterableValueToArray(final Map<String, Iterable<String>> map) {
  ImmutableMap.Builder<String, String[]> builder = ImmutableMap.builder();
  for (Map.Entry<String, Iterable<String>> entry : map.entrySet()) {
    Iterable<String> value = entry.getValue();
    builder.put(entry.getKey(), Iterables.toArray(value, String.class));
  }
  return builder.build();
}
origin: google/guava

@Override
public Map<String, Collection<Integer>> create(Object... elements) {
 ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
 // assumes that each set is a singleton or less (as is done for the samples)
 for (Object elem : elements) {
  @SuppressWarnings("unchecked") // safe by generator contract
  Entry<String, Collection<Integer>> entry = (Entry<String, Collection<Integer>>) elem;
  Integer value = Iterables.getOnlyElement(entry.getValue());
  builder.put(entry.getKey(), value);
 }
 return builder.build().asMultimap().asMap();
}
origin: prestodb/presto

@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
  requireNonNull(prefix, "prefix is null");
  ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> builder = ImmutableMap.builder();
  for (Entry<SchemaTableName, ConnectorTableMetadata> entry : TABLES.entrySet()) {
    if (prefix.matches(entry.getKey())) {
      builder.put(entry.getKey(), entry.getValue().getColumns());
    }
  }
  return builder.build();
}
origin: google/guava

/**
 * Parses a serialized trie representation of a map of reversed public suffixes into an immutable
 * map of public suffixes.
 */
static ImmutableMap<String, PublicSuffixType> parseTrie(CharSequence encoded) {
 ImmutableMap.Builder<String, PublicSuffixType> builder = ImmutableMap.builder();
 int encodedLen = encoded.length();
 int idx = 0;
 while (idx < encodedLen) {
  idx += doParseTrieToBuilder(Lists.<CharSequence>newLinkedList(), encoded, idx, builder);
 }
 return builder.build();
}
origin: prestodb/presto

/**
 * Returns the output to input symbol mapping for the given source channel
 */
public Map<Symbol, SymbolReference> sourceSymbolMap(int sourceIndex)
{
  ImmutableMap.Builder<Symbol, SymbolReference> builder = ImmutableMap.builder();
  for (Map.Entry<Symbol, Collection<Symbol>> entry : outputToInputs.asMap().entrySet()) {
    builder.put(entry.getKey(), Iterables.get(entry.getValue(), sourceIndex).toSymbolReference());
  }
  return builder.build();
}
origin: prestodb/presto

@Override
public Object getInfo()
{
  return ImmutableMap.builder()
      .put("hosts", addresses)
      .put("schema", schema)
      .put("table", table)
      .put("partitionId", partitionId)
      .build();
}
origin: prontera/spring-cloud-rest-tcc

private ImmutableMap<String, Object> fetParamsMap(HttpServletRequest request) {
  final Map<String, String[]> parameterMap = request.getParameterMap();
  final ImmutableMap.Builder<String, Object> singleValueParams = ImmutableMap.builder();
  for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
    singleValueParams.put(entry.getKey(), entry.getValue()[0]);
  }
  return singleValueParams.build();
}
origin: apache/incubator-druid

 private Map<String, Long> getCurrentValues()
 {
  final ImmutableMap.Builder<String, Long> builder = ImmutableMap.builder();
  for (Map.Entry<String, AtomicLong> entry : counters.entrySet()) {
   builder.put(entry.getKey(), entry.getValue().get());
  }
  for (Map.Entry<String, AtomicLong> entry : meters.entrySet()) {
   builder.put(entry.getKey(), entry.getValue().get());
  }
  return builder.build();
 }
};
origin: prestodb/presto

public MemoryInfo getInfo()
{
  ImmutableMap.Builder<MemoryPoolId, MemoryPoolInfo> builder = ImmutableMap.builder();
  for (Map.Entry<MemoryPoolId, MemoryPool> entry : pools.entrySet()) {
    builder.put(entry.getKey(), entry.getValue().getInfo());
  }
  return new MemoryInfo(maxMemory, builder.build());
}
origin: google/guava

/**
 * Creates an {@code ImmutableMap<String, String>} from a {@code Properties} instance. Properties
 * normally derive from {@code Map<Object, Object>}, but they typically contain strings, which is
 * awkward. This method lets you get a plain-old-{@code Map} out of a {@code Properties}.
 *
 * @param properties a {@code Properties} object to be converted
 * @return an immutable map containing all the entries in {@code properties}
 * @throws ClassCastException if any key in {@code Properties} is not a {@code String}
 * @throws NullPointerException if any key or value in {@code Properties} is null
 */
@GwtIncompatible // java.util.Properties
public static ImmutableMap<String, String> fromProperties(Properties properties) {
 ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
 for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
  String key = (String) e.nextElement();
  builder.put(key, properties.getProperty(key));
 }
 return builder.build();
}
com.google.common.collectImmutableMapbuilder

Javadoc

Returns a new builder. The generated builder is equivalent to the builder created by the Builder constructor.

Popular methods of ImmutableMap

  • of
    Returns an immutable map containing the given entries, in order.
  • copyOf
    Returns an immutable map containing the same entries as map. If map somehow contains entries with du
  • get
  • entrySet
    Returns an immutable set of the mappings in this map. The entries are in the same order as the param
  • containsKey
  • keySet
    Returns an immutable set of the keys in this map. These keys are in the same order as the parameters
  • values
    Returns an immutable collection of the values in this map. The values are in the same order as the p
  • isEmpty
  • size
  • equals
  • hashCode
  • toImmutableMap
    Returns a Collector that accumulates elements into an ImmutableMap whose keys and values are the res
  • hashCode,
  • toImmutableMap,
  • getOrDefault,
  • forEach,
  • toString,
  • entryOf,
  • isPartialView,
  • createEntrySet,
  • createKeySet

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Permission (java.security)
    Legacy security code; do not use.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now