当前位置: 首页>>代码示例>>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;未经允许,请勿转载。