本文整理汇总了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());
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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";
}
示例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;
}
示例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;
}
示例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();
}
示例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());
}
示例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;
}