當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。