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


Java ConcurrentHashMap.put方法代码示例

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


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

示例1: getResourceBundle

import com.intellij.util.containers.ConcurrentHashMap; //导入方法依赖的package包/类
public static ResourceBundle getResourceBundle(@NotNull String pathToBundle, @NotNull ClassLoader loader) {
  ConcurrentHashMap<String, SoftReference<ResourceBundle>> map = ourCache.get(loader);
  SoftReference<ResourceBundle> reference = map.get(pathToBundle);
  ResourceBundle result = reference == null ? null : reference.get();
  if (result == null) {
    map.put(pathToBundle, new SoftReference<ResourceBundle>(result = ResourceBundle.getBundle(pathToBundle, Locale.getDefault(), loader)));
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:AbstractBundle.java

示例2: internChildrenHolder

import com.intellij.util.containers.ConcurrentHashMap; //导入方法依赖的package包/类
private static <T extends DomChildDescriptionImpl> ChildrenDescriptionsHolder<T> internChildrenHolder(XmlFile file, ChildrenDescriptionsHolder<T> holder) {
  SoftReference<ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder>> ref = file.getUserData(HOLDERS_CACHE);
  ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder> cache = ref == null ? null : ref.get();
  if (cache == null) {
    cache = new ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder>();
    file.putUserData(HOLDERS_CACHE, new SoftReference<ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder>>(cache));
  }
  ChildrenDescriptionsHolder existing = cache.get(holder);
  if (existing != null) {
    //noinspection unchecked
    return existing;
  }
  cache.put(holder, holder);
  return holder;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:DynamicGenericInfo.java

示例3: getDefaultNSDescriptor

import com.intellij.util.containers.ConcurrentHashMap; //导入方法依赖的package包/类
public XmlNSDescriptor getDefaultNSDescriptor(final String namespace, final boolean strict) {
  long curExtResourcesModCount = ExternalResourceManagerEx.getInstanceEx().getModificationCount(getProject());
  if (myExtResourcesModCount != curExtResourcesModCount) {
    myDefaultDescriptorsCacheNotStrict.clear();
    myDefaultDescriptorsCacheStrict.clear();
    myExtResourcesModCount = curExtResourcesModCount;
  }

  final ConcurrentHashMap<String, CachedValue<XmlNSDescriptor>> defaultDescriptorsCache;
  if (strict) {
    defaultDescriptorsCache = myDefaultDescriptorsCacheStrict;
  }
  else {
    defaultDescriptorsCache = myDefaultDescriptorsCacheNotStrict;
  }

  CachedValue<XmlNSDescriptor> cachedValue = defaultDescriptorsCache.get(namespace);
  if (cachedValue == null) {
    defaultDescriptorsCache.put(namespace, cachedValue = new PsiCachedValueImpl<XmlNSDescriptor>(getManager(), new CachedValueProvider<XmlNSDescriptor>() {
      public Result<XmlNSDescriptor> compute() {
        final XmlNSDescriptor defaultNSDescriptorInner = getDefaultNSDescriptorInner(namespace, strict);

        if (isGeneratedFromDtd(defaultNSDescriptorInner)) {
          return new Result<XmlNSDescriptor>(defaultNSDescriptorInner, XmlDocumentImpl.this, ExternalResourceManager.getInstance());
        }

        return new Result<XmlNSDescriptor>(defaultNSDescriptorInner, defaultNSDescriptorInner != null
                                                                     ? defaultNSDescriptorInner.getDependences()
                                                                     : ExternalResourceManager.getInstance());
      }
    }));
  }
  return cachedValue.getValue();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:XmlDocumentImpl.java


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