Tabnine Logo
HashMap.putAll
Code IndexAdd Tabnine to your IDE (free)

How to use
putAll
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.putAll (Showing top 20 results out of 8,838)

Refine searchRefine arrow

  • HashMap.put
origin: Activiti/Activiti

private Map<String, Object> getParameterMap() {
 HashMap<String, Object> parameterMap = new HashMap<String, Object>();
 parameterMap.put("sql", sqlStatement);
 parameterMap.putAll(parameters);
 return parameterMap;
}
origin: reactor/reactor-core

ContextN(Map<Object, Object> map, Object key, Object value) {
  super(map.size() + 1, 1f);
  super.putAll(map);
  super.put(key, value);
}
origin: stanfordnlp/CoreNLP

private HashMap<String,String> getPOSFeatures(String word, String pos) {
 HashMap<String, String> features = new HashMap<>();
 String wordPos = word.toLowerCase() + '_' + pos;
 if (wordPosFeatureMap.containsKey(wordPos)) {
   features.putAll(wordPosFeatureMap.get(wordPos));
 } else if (posFeatureMap.containsKey(pos)) {
  features.putAll(posFeatureMap.get(pos));
 }
 if (isOrdinal(word, pos)) {
  features.put("NumType", "Ord");
 }
 if (isMultiplicative(word, pos)) {
  features.put("NumType", "Mult");
 }
 return features;
}
origin: apache/hive

 public static Response buildMessage(int httpCode, Map<String, Object> params,
          String msg) {
  HashMap<String, Object> err = new HashMap<String, Object>();
  err.put("error", msg);
  if (params != null)
   err.putAll(params);

  String json = "\"error\"";
  try {
   json = new ObjectMapper().writeValueAsString(err);
  } catch (IOException e) {
  }

  return Response.status(httpCode)
   .entity(json)
   .type(MediaType.APPLICATION_JSON)
   .build();
 }
}
origin: Sable/soot

 @Override
 protected void merge(HashMap<Value, Integer> in1, HashMap<Value, Integer> in2, HashMap<Value, Integer> out) {
  // Copy over in1. This will be the baseline
  out.putAll(in1);

  // Merge in in2. Make sure that we do not have ambiguous values.
  for (Value val : in2.keySet()) {
   Integer i1 = in1.get(val);
   Integer i2 = in2.get(val);
   if (i2.equals(i1)) {
    out.put(val, i2);
   } else {
    throw new RuntimeException("Merge of different IDs not supported");
   }
  }
 }
}
origin: azkaban/azkaban

public static String createJsonResponse(final String status, final String message,
  final String action, final Map<String, Object> params) {
 final HashMap<String, Object> response = new HashMap<>();
 response.put("status", status);
 if (message != null) {
  response.put("message", message);
 }
 if (action != null) {
  response.put("action", action);
 }
 if (params != null) {
  response.putAll(params);
 }
 return JSONUtils.toJSON(response);
}
origin: neo4j/neo4j

VirtualNodeHack( final String label, Map<String,Object> properties )
{
  this.id = MIN_ID.getAndDecrement();
  this.label = Label.label( label );
  propertyMap.putAll( properties );
  propertyMap.put( "name", label );
}
origin: wildfly/wildfly

@Override
@SuppressWarnings("unchecked")
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
  addValidOptions(ALL_VALID_OPTIONS);
  this.realm = options.containsKey(REALM_OPTION) ? (String) options.get(REALM_OPTION) : DEFAULT_REALM;
  HashMap map = new HashMap(options);
  map.putAll(options);
  map.put("hashAlgorithm", "REALM");
  map.put("hashStorePassword", "false");
  super.initialize(subject, callbackHandler, sharedState, map);
}
origin: Activiti/Activiti

protected Map<String, Object> collectTransientVariables(HashMap<String, Object> variables) {
 VariableScopeImpl parentScope = getParentVariableScope();
 if (parentScope != null) {
  variables.putAll(parentScope.collectVariables(variables));
 }
 
 if (transientVariabes != null) {
  for (String variableName : transientVariabes.keySet()) {
   variables.put(variableName, transientVariabes.get(variableName).getValue());
  }
 }
 return variables;
}

origin: apache/hive

/**
 * Build the environment used for all exec calls.
 *
 * @return The environment variables.
 */
public Map<String, String> execEnv(Map<String, String> env) {
 HashMap<String, String> res = new HashMap<String, String>();
 for (String key : appConf.getStrings(AppConfig.EXEC_ENVS_NAME)) {
  String val = System.getenv(key);
  if (val != null) {
   res.put(key, val);
  }
 }
 if (env != null)
  res.putAll(env);
 for (Map.Entry<String, String> envs : res.entrySet()) {
  LOG.info("Env " + envs.getKey() + "=" + envs.getValue());
 }
 return res;
}
origin: alibaba/Sentinel

/**
 * <p>Get {@link Node} of the specific origin. Usually the origin is the Service Consumer's app name.</p>
 * <p>If the origin node for given origin is absent, then a new {@link StatisticNode}
 * for the origin will be created and returned.</p>
 *
 * @param origin The caller's name, which is designated in the {@code parameter} parameter
 *               {@link ContextUtil#enter(String name, String origin)}.
 * @return the {@link Node} of the specific origin
 */
public Node getOrCreateOriginNode(String origin) {
  StatisticNode statisticNode = originCountMap.get(origin);
  if (statisticNode == null) {
    try {
      lock.lock();
      statisticNode = originCountMap.get(origin);
      if (statisticNode == null) {
        // The node is absent, create a new node for the origin.
        statisticNode = new StatisticNode();
        HashMap<String, StatisticNode> newMap = new HashMap<String, StatisticNode>(
          originCountMap.size() + 1);
        newMap.putAll(originCountMap);
        newMap.put(origin, statisticNode);
        originCountMap = newMap;
      }
    } finally {
      lock.unlock();
    }
  }
  return statisticNode;
}
origin: Activiti/Activiti

protected Map<String, VariableInstance> collectVariableInstances(HashMap<String, VariableInstance> variables) {
 ensureVariableInstancesInitialized();
 VariableScopeImpl parentScope = getParentVariableScope();
 if (parentScope != null) {
  variables.putAll(parentScope.collectVariableInstances(variables));
 }
 for (VariableInstance variableInstance : variableInstances.values()) {
  variables.put(variableInstance.getName(), variableInstance);
 }
 for (String variableName : usedVariablesCache.keySet()) {
  variables.put(variableName, usedVariablesCache.get(variableName));
 }
 
 if (transientVariabes != null) {
  variables.putAll(transientVariabes);
 }
 return variables;
}
origin: com.h2database/h2

/**
 * Update session meta data information and get the information in a map.
 *
 * @return a map containing the session meta data
 */
HashMap<String, Object> getInfo() {
  HashMap<String, Object> m = new HashMap<>(map.size() + 5);
  m.putAll(map);
  m.put("lastAccess", new Timestamp(lastAccess).toString());
  try {
    m.put("url", conn == null ?
        "${text.admin.notConnected}" : conn.getMetaData().getURL());
    m.put("user", conn == null ?
        "-" : conn.getMetaData().getUserName());
    m.put("lastQuery", commandHistory.isEmpty() ?
        "" : commandHistory.get(0));
    m.put("executing", executingStatement == null ?
        "${text.admin.no}" : "${text.admin.yes}");
  } catch (SQLException e) {
    DbException.traceThrowable(e);
  }
  return m;
}
origin: igniterealtime/Smack

@Override
public HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) {
  HashMap<Integer, T_Sess> sessions = getCache(userDevice).sessions.get(contact);
  if (sessions == null) {
    sessions = new HashMap<>();
    getCache(userDevice).sessions.put(contact, sessions);
  }
  if (sessions.isEmpty() && persistent != null) {
    sessions.putAll(persistent.loadAllRawSessionsOf(userDevice, contact));
  }
  return new HashMap<>(sessions);
}
origin: NLPchina/elasticsearch-sql

protected void  onlyReturnedFields(Map<String, Object> fieldsMap, List<Field> required,boolean allRequired) {
  HashMap<String,Object> filteredMap = new HashMap<>();
  if(allFieldsReturn || allRequired) {
    filteredMap.putAll(fieldsMap);
    return;
  }
  for(Field field: required){
    String name = field.getName();
    String returnName = name;
    String alias = field.getAlias();
    if(alias !=null && alias !=""){
      returnName = alias;
      aliasesOnReturn.add(alias);
    }
    filteredMap.put(returnName, deepSearchInMap(fieldsMap, name));
  }
  fieldsMap.clear();
  fieldsMap.putAll(filteredMap);
}
origin: geoserver/geoserver

public String[][] getHeaders(Object value, Operation operation) throws ServiceException {
  Response delegate = (Response) value;
  HashMap map = new HashMap();
  if (delegate.getContentDisposition() != null) {
    map.put("Content-Disposition", delegate.getContentDisposition());
  }
  HashMap m = delegate.getResponseHeaders();
  if (m != null && !m.isEmpty()) {
    map.putAll(m);
  }
  if (map == null || map.isEmpty()) return null;
  String[][] headers = new String[map.size()][2];
  List keys = new ArrayList(map.keySet());
  for (int i = 0; i < headers.length; i++) {
    headers[i][0] = (String) keys.get(i);
    headers[i][1] = (String) map.get(keys.get(i));
  }
  return headers;
}
origin: Sable/soot

protected void flowThrough(HashMap<Local, Set<NewExpr>> in, Unit unit, HashMap<Local, Set<NewExpr>> out) {
 Stmt s = (Stmt) unit;
 out.clear();
 out.putAll(in);
 if (s instanceof DefinitionStmt) {
  DefinitionStmt ds = (DefinitionStmt) s;
  Value lhs = ds.getLeftOp();
  Value rhs = ds.getRightOp();
  if (lhs instanceof Local) {
   HashSet<NewExpr> lv = new HashSet<NewExpr>();
   out.put((Local) lhs, lv);
   if (rhs instanceof NewExpr) {
    lv.add((NewExpr) rhs);
   } else if (rhs instanceof Local) {
    lv.addAll(in.get(rhs));
   } else {
    lv.add(UNKNOWN);
   }
  }
 }
}
origin: Graylog2/graylog2-server

@AssistedInject
public MessageCountAlertCondition(Searches searches,
                 @Assisted Stream stream,
                 @Nullable @Assisted("id") String id,
                 @Assisted DateTime createdAt,
                 @Assisted("userid") String creatorUserId,
                 @Assisted Map<String, Object> parameters,
                 @Nullable @Assisted("title") String title) {
  super(stream, id, Type.MESSAGE_COUNT.toString(), createdAt, creatorUserId, parameters, title);
  this.searches = searches;
  this.time = Tools.getNumber(parameters.get("time"), 5).intValue();
  final String thresholdType = (String) parameters.get("threshold_type");
  final String upperCaseThresholdType = thresholdType.toUpperCase(Locale.ENGLISH);
  /*
   * Alert conditions created before 2.2.0 had a threshold_type parameter in lowercase, but this was
   * inconsistent with the parameters in FieldValueAlertCondition, which were always stored in uppercase.
   * To ensure we return the expected case in the API and also store the right case in the database, we
   * are converting the parameter to uppercase here, if it wasn't uppercase already.
   */
  if (!thresholdType.equals(upperCaseThresholdType)) {
    final HashMap<String, Object> updatedParameters = new HashMap<>();
    updatedParameters.putAll(parameters);
    updatedParameters.put("threshold_type", upperCaseThresholdType);
    super.setParameters(updatedParameters);
  }
  this.thresholdType = ThresholdType.valueOf(upperCaseThresholdType);
  this.threshold = Tools.getNumber(parameters.get("threshold"), 0).intValue();
  this.query = (String) parameters.getOrDefault(CK_QUERY, CK_QUERY_DEFAULT_VALUE);
}
origin: json-iterator/java

private static Map<String, Type> collectTypeVariableLookup(Type type) {
  HashMap<String, Type> vars = new HashMap<String, Type>();
  if (null == type) {
    return vars;
  }
  if (type instanceof ParameterizedType) {
    ParameterizedType pType = (ParameterizedType) type;
    Type[] actualTypeArguments = pType.getActualTypeArguments();
    Class clazz = (Class) pType.getRawType();
    for (int i = 0; i < clazz.getTypeParameters().length; i++) {
      TypeVariable variable = clazz.getTypeParameters()[i];
      vars.put(variable.getName() + "@" + clazz.getCanonicalName(), actualTypeArguments[i]);
    }
    vars.putAll(collectTypeVariableLookup(clazz.getGenericSuperclass()));
    return vars;
  }
  if (type instanceof Class) {
    Class clazz = (Class) type;
    vars.putAll(collectTypeVariableLookup(clazz.getGenericSuperclass()));
    return vars;
  }
  if (type instanceof WildcardType) {
    return vars;
  }
  throw new JsonException("unexpected type: " + type);
}
origin: JetBrains/ideavim

@Nullable
private HashMap<Character, Mark> getAllFileMarks(@NotNull final Document doc) {
 VirtualFile vf = FileDocumentManager.getInstance().getFile(doc);
 if (vf == null) {
  return null;
 }
 HashMap<Character, Mark> res = new HashMap<>();
 FileMarks<Character, Mark> fileMarks = getFileMarks(doc);
 if (fileMarks != null) {
  res.putAll(fileMarks);
 }
 for (Character ch : globalMarks.keySet()) {
  Mark mark = globalMarks.get(ch);
  if (vf.getPath().equals(mark.getFilename())) {
   res.put(ch, mark);
  }
 }
 return res;
}
java.utilHashMapputAll

Javadoc

Copies all the mappings in the specified map to this map. These mappings will replace all mappings that this map had for any of the keys currently in the given map.

Popular methods of HashMap

  • <init>
    Constructs a new HashMap instance containing the mappings from the specified map.
  • put
    Maps the specified key to the specified value.
  • get
    Returns the value of the mapping with the specified key.
  • containsKey
    Returns whether this map contains the specified key.
  • keySet
    Returns a set of the keys contained in this map. The set is backed by this map so changes to one are
  • remove
  • entrySet
    Returns a set containing all of the mappings in this map. Each mapping is an instance of Map.Entry.
  • values
    Returns a collection of the values contained in this map. The collection is backed by this map so ch
  • size
    Returns the number of elements in this map.
  • clear
    Removes all mappings from this hash map, leaving it empty.
  • isEmpty
    Returns whether this map is empty.
  • clone
    Returns a shallow copy of this map.
  • isEmpty,
  • clone,
  • toString,
  • containsValue,
  • equals,
  • hashCode,
  • computeIfAbsent,
  • getOrDefault,
  • forEach

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm 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