當前位置: 首頁>>代碼示例>>Java>>正文


Java ConcurrentHashMap.Entry方法代碼示例

本文整理匯總了Java中java.util.concurrent.ConcurrentHashMap.Entry方法的典型用法代碼示例。如果您正苦於以下問題:Java ConcurrentHashMap.Entry方法的具體用法?Java ConcurrentHashMap.Entry怎麽用?Java ConcurrentHashMap.Entry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.concurrent.ConcurrentHashMap的用法示例。


在下文中一共展示了ConcurrentHashMap.Entry方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: post

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
/**
 * Post請求的Rxjava方式.
 * @param url
 * @param requestParams
 * @return
 */
public <T> Flowable<T> post(String url, EasyRequestParams requestParams, RxEasyConverter<T> rxEasyConverter) {
	FormBody.Builder builder = new FormBody.Builder();
	ConcurrentHashMap<String, String> paramsMap = requestParams.getRequestParams();
	for (ConcurrentHashMap.Entry<String, String> entry : paramsMap.entrySet()) {
		builder.add(entry.getKey(), entry.getValue());
	}

	RequestBody requestBody = builder.build();
	final Request request = new Request.Builder()
			.url(url)
			.post(requestBody)
			.build();

	Call call = EasyHttpClientManager.getInstance().getOkHttpClient(EasyCacheType.CACHE_TYPE_DEFAULT).newCall(request);

	return Flowable.create(new CallFlowableOnSubscribe(call,rxEasyConverter), BackpressureStrategy.BUFFER)
			.subscribeOn(Schedulers.io());
}
 
開發者ID:LaurenceYang,項目名稱:EasyHttp,代碼行數:25,代碼來源:RxEasyHttpManager.java

示例2: removeAllUserHistoryDictionaries

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
public static void removeAllUserHistoryDictionaries(final Context context) {
    synchronized (sLangUserHistoryDictCache) {
        for (final ConcurrentHashMap.Entry<String, SoftReference<UserHistoryDictionary>> entry
                : sLangUserHistoryDictCache.entrySet()) {
            if (entry.getValue() != null) {
                final UserHistoryDictionary dict = entry.getValue().get();
                if (dict != null) {
                    dict.clear();
                }
            }
        }
        sLangUserHistoryDictCache.clear();
        final File filesDir = context.getFilesDir();
        if (filesDir == null) {
            Log.e(TAG, "context.getFilesDir() returned null.");
            return;
        }
        final boolean filesDeleted = FileUtils.deleteFilteredFiles(
                filesDir, new DictFilter(UserHistoryDictionary.NAME));
        if (!filesDeleted) {
            Log.e(TAG, "Cannot remove dictionary files. filesDir: " + filesDir.getAbsolutePath()
                    + ", dictNamePrefix: " + UserHistoryDictionary.NAME);
        }
    }
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:26,代碼來源:PersonalizationHelper.java

示例3: clearExpired

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
@Override
public boolean clearExpired(Date date) {
    boolean clearedAny = false;
    SharedPreferences.Editor prefsWriter = cookiePrefs.edit();

    for (ConcurrentHashMap.Entry<String, Cookie> entry : cookies.entrySet()) {
        String name = entry.getKey();
        Cookie cookie = entry.getValue();
        if (cookie.isExpired(date)) {
            // Clear cookies from local store
            cookies.remove(name);

            // Clear cookies from persistent store
            prefsWriter.remove(COOKIE_NAME_PREFIX + name);

            // We've cleared at least one
            clearedAny = true;
        }
    }

    // Update names in persistent store
    if (clearedAny) {
        prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", cookies.keySet()));
    }
    prefsWriter.commit();

    return clearedAny;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:PersistentCookieStore.java

示例4: getParamsList

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
protected List<BasicNameValuePair> getParamsList() {
    List<BasicNameValuePair> lparams = new LinkedList<BasicNameValuePair>();

    for (ConcurrentHashMap.Entry<String, String> entry : urlParams.entrySet()) {
        lparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
    }

    lparams.addAll(getParamsList(null, urlParamsWithObjects));

    return lparams;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:RequestParams.java

示例5: clearExpired

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
@Override
public boolean clearExpired(Date date) {
    boolean clearedAny = false;
    SharedPreferences.Editor prefsWriter = cookiePrefs.edit();

    for (ConcurrentHashMap.Entry<String, Cookie> entry : cookies.entrySet()) {
        String name = entry.getKey();
        Cookie cookie = entry.getValue();
        if (cookie.isExpired(date)) {
            // Clear cookies from local store
            cookies.remove(name);

            // Clear cookies from persistent store
            prefsWriter.remove(COOKIE_NAME_PREFIX + name);

            // We've cleared at least one
            clearedAny = true;
        }
    }

    // Update names in persistent store
    if (clearedAny) {
        // This prevents map.keySet to compile to a Java 8+ KeySetView return type
        Map<String, Cookie> map = cookies;
        prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", map.keySet()));
    }
    prefsWriter.apply();

    return clearedAny;
}
 
開發者ID:Vorlonsoft,項目名稱:AndroidAsyncHTTP,代碼行數:31,代碼來源:PersistentCookieStore.java

示例6: getEntity

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
/**
 * Returns an HttpEntity containing all request parameters
 */
public HttpEntity getEntity() {

    if (bodyEntity != null) {
        return bodyEntity;
    }

    HttpEntity result = null;

    if (fileParams != null && !fileParams.isEmpty()) {

        MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.STRICT, null, Charset.forName(charset));

        if (bodyParams != null && !bodyParams.isEmpty()) {
            for (NameValuePair param : bodyParams.values()) {
                try {
                    multipartEntity.addPart(param.getName(), new StringBody(param.getValue()));
                } catch (UnsupportedEncodingException e) {
                    LogUtils.e(e.getMessage(), e);
                }
            }
        }

        for (ConcurrentHashMap.Entry<String, ContentBody> entry : fileParams.entrySet()) {
            multipartEntity.addPart(entry.getKey(), entry.getValue());
        }

        result = multipartEntity;
    } else if (bodyParams != null && !bodyParams.isEmpty()) {
        result = new BodyParamsEntity(new ArrayList<NameValuePair>(bodyParams.values()), charset);
    }

    return result;
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:37,代碼來源:RequestParams.java

示例7: currentlog

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
@RequestMapping(value = "/apistatisticday", method = RequestMethod.GET)
public String currentlog(Model model,
                         @RequestParam(value = "topdatarange", required = false, defaultValue = "0") String topdaterange,
                         @RequestParam(value = "url", required = false, defaultValue = "") String url
) {

    //date list
    List<String> timelist = DateTimeHelper.getDateTimeListForPage(fieryConfig.getKeepdataday());
    model.addAttribute("datelist", timelist);
    model.addAttribute("datelist_selected", topdaterange);

    model.addAttribute("url", url);

    //now the date render
    long shardtime = DateTimeHelper.getTimesMorning(DateTimeHelper.getBeforeDay(Integer.parseInt(topdaterange)));

    TreeMap<Long, APIStatisticStruct> urlList = apiStatisticTimeSet.getHourDetail(url, shardtime);

    //log.info("size:" + urlList.size());

    model.addAttribute("urllist", urlList);

    //http code
    TreeMap<String, Long> httpCodeMap = new TreeMap<>();
    for (Map.Entry<Long, APIStatisticStruct> timeItem : urlList.entrySet()) {
        for (ConcurrentHashMap.Entry<String, AtomicLong> httpitem : timeItem.getValue().getCode_count().entrySet()) {
            if (!httpCodeMap.containsKey(httpitem.getKey())) {
                httpCodeMap.put(httpitem.getKey(), httpitem.getValue().longValue());
            } else {
                httpCodeMap.put(httpitem.getKey(), httpCodeMap.get(httpitem.getKey()) + httpitem.getValue().longValue());
            }
        }

    }

    model.addAttribute("httpcode", httpCodeMap);

    return "apistatisticday";
}
 
開發者ID:weiboad,項目名稱:fiery,代碼行數:40,代碼來源:APIStatisticDayPage.java

示例8: getProviderSideAutoActives

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
/**
 * 得到服務端的全部自動激活擴展
 *
 * @return 自動激活擴展列表
 */
public List<ExtensibleClass> getProviderSideAutoActives() {
    List<ExtensibleClass> extensibleClasses = new ArrayList<ExtensibleClass>();
    for (ConcurrentHashMap.Entry<String, ExtensibleClass> entry : all.entrySet()) {
        ExtensibleClass extensibleClass = entry.getValue();
        if (extensibleClass.isAutoActive() && extensibleClass.isProviderSide()) {
            extensibleClasses.add(extensibleClass);
        }
    }
    Collections.sort(extensibleClasses, new OrderComparator());
    return extensibleClasses;
}
 
開發者ID:tiglabs,項目名稱:jsf-sdk,代碼行數:17,代碼來源:ExtensionLoader.java

示例9: getConsumerSideAutoActives

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
/**
 * 得到調用端的全部自動激活擴展
 *
 * @return 自動激活擴展列表
 */
public List<ExtensibleClass> getConsumerSideAutoActives() {
    List<ExtensibleClass> extensibleClasses = new ArrayList<ExtensibleClass>();
    for (ConcurrentHashMap.Entry<String, ExtensibleClass> entry : all.entrySet()) {
        ExtensibleClass extensibleClass = entry.getValue();
        if (extensibleClass.isAutoActive() && extensibleClass.isConsumerSide()) {
            extensibleClasses.add(extensibleClass);
        }
    }
    Collections.sort(extensibleClasses, new OrderComparator());
    return extensibleClasses;
}
 
開發者ID:tiglabs,項目名稱:jsf-sdk,代碼行數:17,代碼來源:ExtensionLoader.java

示例10: toString

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
@Override
public String toString() {
    StringBuilder result = new StringBuilder();
    for (ConcurrentHashMap.Entry<String, String> entry : mRequestParams.entrySet()) {
        if (result.length() > 0)
            result.append("&");

        result.append(entry.getKey());
        result.append("=");
        result.append(entry.getValue());
    }
    return result.toString();
}
 
開發者ID:LaurenceYang,項目名稱:EasyHttp,代碼行數:14,代碼來源:EasyRequestParams.java

示例11: intercept

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
@Override
public Response intercept(Chain chain) throws IOException {
    final Request originalRequest = chain.request();

    Request.Builder builder = originalRequest.newBuilder();

    if (mHeaders != null) {
        for (ConcurrentHashMap.Entry<String, String> entry : mHeaders.entrySet()) {
            builder.addHeader(entry.getKey(), entry.getValue());
        }
    }

    return chain.proceed(builder.build());
}
 
開發者ID:LaurenceYang,項目名稱:EasyHttp,代碼行數:15,代碼來源:EasyHeaderInterceptor.java

示例12: clearExpired

import java.util.concurrent.ConcurrentHashMap; //導入方法依賴的package包/類
@Override
public boolean clearExpired(Date date) {
    boolean clearedAny = false;
    SharedPreferences.Editor prefsWriter = cookiePrefs.edit();

    for (ConcurrentHashMap.Entry<String, Cookie> entry : cookies.entrySet()) {
        String name = entry.getKey();
        Cookie cookie = entry.getValue();
        if (cookie.isExpired(date)) {
            // Clear cookies from local store
            cookies.remove(name);

            // Clear cookies from persistent store
            prefsWriter.remove(COOKIE_NAME_PREFIX + name);

            // We've cleared at least one
            clearedAny = true;
        }
    }

    // Update names in persistent store
    if (clearedAny) {
        prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", cookies.keySet()));
    }
    prefsWriter.apply();

    return clearedAny;
}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:29,代碼來源:PersistentCookieStore.java


注:本文中的java.util.concurrent.ConcurrentHashMap.Entry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。