当前位置: 首页>>代码示例>>Java>>正文


Java HashMap.putAll方法代码示例

本文整理汇总了Java中java.util.HashMap.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java HashMap.putAll方法的具体用法?Java HashMap.putAll怎么用?Java HashMap.putAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.HashMap的用法示例。


在下文中一共展示了HashMap.putAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchAuditHistory

import java.util.HashMap; //导入方法依赖的package包/类
/**
 * Method to search audit history logs
 * 
 * @return
 */
public Promise<Result> searchAuditHistory() {
  try {
    JsonNode requestData = request().body().asJson();
    ProjectLogger.log("Request for Search Audit History: " + requestData, LoggerEnum.INFO.name());
    Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
    reqObj.setOperation(ActorOperations.SEARCH_AUDIT_LOG.getValue());
    reqObj.setRequestId(ExecutionContext.getRequestId());
    reqObj.setEnv(getEnvironment());
    HashMap<String, Object> innerMap = new HashMap<>();
    innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
    innerMap.putAll(reqObj.getRequest());
    reqObj.setRequest(innerMap);
    return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
  } catch (Exception e) {
    return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:23,代码来源:AuditLogController.java

示例2: multipartCommit

import java.util.HashMap; //导入方法依赖的package包/类
/** For intelligent ingestion mode only. Called when all chunks of a part have been uploaded. */
private void multipartCommit() throws Exception {
  final HashMap<String, RequestBody> params = new HashMap<>();
  params.putAll(upload.baseParams);
  params.put("part", Util.createStringPart(Integer.toString(container.num)));

  RetryNetworkFunc<ResponseBody> func;
  func = new RetryNetworkFunc<ResponseBody>(5, 5, Upload.DELAY_BASE) {
    @Override
    Response<ResponseBody> work() throws Exception {
      return Networking.getUploadService().commit(params).execute();
    }
  };

  func.call();
}
 
开发者ID:filestack,项目名称:filestack-java,代码行数:17,代码来源:UploadTransferFunc.java

示例3: assertWontGrow

import java.util.HashMap; //导入方法依赖的package包/类
@GwtIncompatible // reflection
private static void assertWontGrow(
    int size, HashMap<Object, Object> map1, HashMap<Object, Object> map2) throws Exception {
  // Only start measuring table size after the first element inserted, to
  // deal with empty-map optimization.
  map1.put(0, null);

  int initialBuckets = bucketsOf(map1);

  for (int i = 1; i < size; i++) {
    map1.put(i, null);
  }
  assertThat(bucketsOf(map1))
      .named("table size after adding " + size + " elements")
      .isEqualTo(initialBuckets);

  /*
   * Something slightly different happens when the entries are added all at
   * once; make sure that passes too.
   */
  map2.putAll(map1);
  assertThat(bucketsOf(map1))
      .named("table size after adding " + size + " elements")
      .isEqualTo(initialBuckets);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:26,代码来源:MapsTest.java

示例4: getDados

import java.util.HashMap; //导入方法依赖的package包/类
public HashMap<String, Object> getDados() {
    HashMap<String, Object> mapLista = new HashMap<>();
    ResultSet rs = Call.selectFrom("VER_AMORTIZACAO where \"ID PRESTACAO\" = ?", "*", numPrestacao);
    Consumer<HashMap<String, Object>> act = (map) -> {
        mapLista.putAll(map);
    };
    Call.forEchaResultSet(act, rs);
    return mapLista;
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:10,代码来源:ReciboPagamento.java

示例5: show

import java.util.HashMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	MobSDK.init(context.getApplicationContext());
	ShareSDK.initSDK(context);

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:32,代码来源:OnekeyShare.java

示例6: commitClickEvent

import java.util.HashMap; //导入方法依赖的package包/类
public void commitClickEvent(HashMap<String, Object> commonInfo, String viewName, HashMap<String, Object> viewData) {
    if (TextUtils.isEmpty(viewName)) {
        TrackerLog.d("commitClickEvent viewName is null");
        return;
    }
    TrackerLog.d("viewName=" + viewName);

    HashMap<String, String> argsInfo = new HashMap<String, String>();
    // add the common info
    if (commonInfo != null && !commonInfo.isEmpty()) {
        argsInfo.putAll(TrackerUtil.getHashMap(commonInfo));
    }

    if (argsInfo.containsKey(TrackerConstants.PAGE_NAME)) {
        argsInfo.remove(TrackerConstants.PAGE_NAME);
    }
    // add the special info
    if (viewData != null && !viewData.isEmpty()) {
        argsInfo.putAll(TrackerUtil.getHashMap(viewData));
    }

    if (GlobalsContext.trackerOpen) {
        if (!argsInfo.isEmpty()) {
            TrackerUtil.commitCtrlEvent(viewName, argsInfo);
        } else {
            TrackerUtil.commitCtrlEvent(viewName, null);
        }
    }
}
 
开发者ID:alibaba,项目名称:android_viewtracker,代码行数:30,代码来源:DataCommitImpl.java

示例7: createModel

import java.util.HashMap; //导入方法依赖的package包/类
/**
 * Creates the corresponding model for this template with some variables.
 * 
 * @param otherVariables The variables.
 * 
 * @return The corresponding JTwig model.
 */

public final JtwigModel createModel(final Map<String, Object> otherVariables) {
	final HashMap<String, Object> variables = new HashMap<String, Object>(this.variables);
	if(otherVariables != null) {
		variables.putAll(otherVariables);
	}
	return JtwigModel.newModel(variables)
			.with(Constants.VARIABLE_GENERATOR_NAME, Constants.APP_NAME)
			.with(Constants.VARIABLE_GENERATOR_VERSION, Constants.APP_VERSION)
			.with(Constants.VARIABLE_GENERATOR_WEBSITE, Constants.APP_WEBSITE);
}
 
开发者ID:Skyost,项目名称:SkyDocs,代码行数:19,代码来源:DocsTemplate.java

示例8: ConditionalCountAlertCondition

import java.util.HashMap; //导入方法依赖的package包/类
@AssistedInject
public ConditionalCountAlertCondition(Searches searches,
                                       Configuration configuration,
                                       @Assisted Stream stream,
                                       @Nullable @Assisted("id") String id,
                                       @Assisted DateTime createdAt,
                                       @Assisted("userid") String creatorUserId,
                                       @Assisted Map<String, Object> parameters,
                                       @Assisted("title") @Nullable String title) {
    super(stream, id, ConditionalCountAlertCondition.class.getCanonicalName(), createdAt, creatorUserId, parameters, title);
    this.searches = searches;
    this.configuration = configuration;
    this.query = (String) parameters.get("query");
    this.time = Tools.getNumber(parameters.get("time"), 5).intValue();

    final String thresholdType = (String) parameters.get("threshold_type");
    final String upperCaseThresholdType = thresholdType.toUpperCase(Locale.ENGLISH);

    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();
}
 
开发者ID:alcampos,项目名称:graylog-plugin-alert-conditional-count,代码行数:28,代码来源:ConditionalCountAlertCondition.java

示例9: getHeaderAttributeMap

import java.util.HashMap; //导入方法依赖的package包/类
protected Map<String, String> getHeaderAttributeMap() {
    HashMap<String, String> attributeMap = new HashMap<>();
    if (mAdditionalAttributeMap != null) {
        attributeMap.putAll(mAdditionalAttributeMap);
    }
    attributeMap.put(DictionaryHeader.DICTIONARY_ID_KEY, mDictName);
    attributeMap.put(DictionaryHeader.DICTIONARY_LOCALE_KEY, mLocale.toString());
    attributeMap.put(DictionaryHeader.DICTIONARY_VERSION_KEY,
            String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));
    return attributeMap;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:12,代码来源:ExpandableBinaryDictionary.java

示例10: getControllerNodeIPs

import java.util.HashMap; //导入方法依赖的package包/类
@Override
public Map<String, String> getControllerNodeIPs() {
    // We return a copy of the mapping so we can guarantee that
    // the mapping return is the same as one that will be (or was)
    // dispatched to IHAListeners
    HashMap<String,String> retval = new HashMap<String,String>();
    synchronized(controllerNodeIPsCache) {
        retval.putAll(controllerNodeIPsCache);
    }
    return retval;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:12,代码来源:Controller.java

示例11: writeTo

import java.util.HashMap; //导入方法依赖的package包/类
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalString(this.getMessage());
    out.writeException(this.getCause());
    writeStackTraces(this, out);
    if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
        out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString);
        out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
    } else {
        HashMap<String, List<String>> finalHeaders = new HashMap<>(headers.size() + metadata.size());
        finalHeaders.putAll(headers);
        finalHeaders.putAll(metadata);
        out.writeMapOfLists(finalHeaders, StreamOutput::writeString, StreamOutput::writeString);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:ElasticsearchException.java

示例12: getStats

import java.util.HashMap; //导入方法依赖的package包/类
public HashMap<String, Stats> getStats() {
    HashMap<String, Stats> tstats = new HashMap<>();
    synchronized (lock) {
        if (networkStats.isEmpty()) {
            networkStats = readStats();
            if (networkStats == null) {
                networkStats = new HashMap<>();
            }
        }
        tstats.putAll(networkStats);
    }
    return tstats;
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:14,代码来源:StatsCache.java

示例13: cleanOfflineBroker

import java.util.HashMap; //导入方法依赖的package包/类
/**
 * Remove offline broker
 */
private void cleanOfflineBroker() {
    try {
        if (this.lockNamesrv.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS))
            try {
                ConcurrentHashMap<String, HashMap<Long, String>> updatedTable = new ConcurrentHashMap<String, HashMap<Long, String>>();

                Iterator<Entry<String, HashMap<Long, String>>> itBrokerTable = this.brokerAddrTable.entrySet().iterator();
                while (itBrokerTable.hasNext()) {
                    Entry<String, HashMap<Long, String>> entry = itBrokerTable.next();
                    String brokerName = entry.getKey();
                    HashMap<Long, String> oneTable = entry.getValue();

                    HashMap<Long, String> cloneAddrTable = new HashMap<Long, String>();
                    cloneAddrTable.putAll(oneTable);

                    Iterator<Entry<Long, String>> it = cloneAddrTable.entrySet().iterator();
                    while (it.hasNext()) {
                        Entry<Long, String> ee = it.next();
                        String addr = ee.getValue();
                        if (!this.isBrokerAddrExistInTopicRouteTable(addr)) {
                            it.remove();
                            log.info("the broker addr[{} {}] is offline, remove it", brokerName, addr);
                        }
                    }

                    if (cloneAddrTable.isEmpty()) {
                        itBrokerTable.remove();
                        log.info("the broker[{}] name's host is offline, remove it", brokerName);
                    } else {
                        updatedTable.put(brokerName, cloneAddrTable);
                    }
                }

                if (!updatedTable.isEmpty()) {
                    this.brokerAddrTable.putAll(updatedTable);
                }
            } finally {
                this.lockNamesrv.unlock();
            }
    } catch (InterruptedException e) {
        log.warn("cleanOfflineBroker Exception", e);
    }
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:47,代码来源:MQClientInstance.java

示例14: performRequest

import java.util.HashMap; //导入方法依赖的package包/类
@Override
public HttpResponse performRequest(Request<?> request, Map<String, String> additionalHeaders)
        throws IOException, AuthFailureError {
    String url = request.getUrl();
    HashMap<String, String> map = new HashMap<String, String>();
    map.putAll(request.getHeaders());
    map.putAll(additionalHeaders);
    if (mUrlRewriter != null) {
        String rewritten = mUrlRewriter.rewriteUrl(url);
        if (rewritten == null) {
            throw new IOException("URL blocked by rewriter: " + url);
        }
        url = rewritten;
    }
    URL parsedUrl = new URL(url);
    HttpURLConnection connection = openConnection(parsedUrl, request);
    for (String headerName : map.keySet()) {
        connection.addRequestProperty(headerName, map.get(headerName));
    }
    setConnectionParametersForRequest(connection, request);
    // Initialize HttpResponse with data from the HttpURLConnection.
    ProtocolVersion protocolVersion = new ProtocolVersion("HTTP", 1, 1);
    int responseCode = connection.getResponseCode();
    if (responseCode == -1) {
        // -1 is returned by getResponseCode() if the response code could not be retrieved.
        // Signal to the caller that something was wrong with the connection.
        throw new IOException("Could not retrieve response code from HttpUrlConnection.");
    }
    StatusLine responseStatus = new BasicStatusLine(protocolVersion,
            connection.getResponseCode(), connection.getResponseMessage());
    BasicHttpResponse response = new BasicHttpResponse(responseStatus);
    response.setEntity(entityFromConnection(connection));
    for (Entry<String, List<String>> header : connection.getHeaderFields().entrySet()) {
        if (header.getKey() != null) {
            Header h = new BasicHeader(header.getKey(), header.getValue().get(0));
            response.addHeader(h);
        }
    }
    return response;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:41,代码来源:HurlStack.java

示例15: performRequest

import java.util.HashMap; //导入方法依赖的package包/类
@Override
public HttpResponse performRequest(Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError {

    String friendlyName = System.currentTimeMillis() + "";
    StethoURLConnectionManager connectionManager = new StethoURLConnectionManager(friendlyName);

    String urlString = request.getUrl();
    HashMap<String, String> map = new HashMap<String, String>();
    map.putAll(request.getHeaders());
    map.putAll(additionalHeaders);

    URL url = new URL(urlString);

    HttpURLConnection connection = openConnection(url, request);

    for (String headerName : map.keySet()) {
        connection.addRequestProperty(headerName, map.get(headerName));
    }
    connection.addRequestProperty("Accept-Encoding","gzip");
    boolean isPreConnected = setConnectionParametersForRequest(connectionManager, connection, request);

    ProtocolVersion protocolVersion = new ProtocolVersion("HTTP", 1, 1);

    if (!isPreConnected) {
        preConnect(connectionManager,connection,null);
    }

    int responseCode = connection.getResponseCode();
    if (responseCode == -1) {
        throw new IOException("Could not retrieve response code from HttpUrlConnection.");
    }

    StatusLine responseStatus = new BasicStatusLine(protocolVersion,
            connection.getResponseCode(), connection.getResponseMessage());
    BasicHttpResponse response = new BasicHttpResponse(responseStatus);

    postConnect(connectionManager);

    if (hasResponseBody(request.getMethod(), responseStatus.getStatusCode())) {
        response.setEntity(entityFromConnection(connection));
    }
    for (Map.Entry<String, List<String>> header : connection.getHeaderFields().entrySet()) {
        if (header.getKey() != null) {
            Header h = new BasicHeader(header.getKey(), header.getValue().get(0));
            response.addHeader(h);
        }
    }

    return response;
}
 
开发者ID:DLKanth,项目名称:Stetho-Volley,代码行数:51,代码来源:StethoVolleyStack.java


注:本文中的java.util.HashMap.putAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。