• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConcurrentWeakHashMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ConcurrentWeakHashMap类属于com.intellij.util.containers包,在下文中一共展示了ConcurrentWeakHashMap类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getVariablesToFix

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
@NotNull
private Collection<PsiVariable> getVariablesToFix() {
  Map<PsiVariable, Boolean> vars = myClass.getUserData(VARS[myFixType]);
  if (vars == null) myClass.putUserData(VARS[myFixType], vars = new ConcurrentWeakHashMap<PsiVariable, Boolean>(1));
  final Map<PsiVariable, Boolean> finalVars = vars;
  return new AbstractCollection<PsiVariable>() {
    @Override
    public boolean add(PsiVariable psiVariable) {
      return finalVars.put(psiVariable, Boolean.TRUE) == null;
    }

    @Override
    public Iterator<PsiVariable> iterator() {
      return finalVars.keySet().iterator();
    }

    @Override
    public int size() {
      return finalVars.size();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:VariableAccessFromInnerClassFix.java


示例2: shouldAbbreviateName

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private static boolean shouldAbbreviateName(PsiPackage aPackage) {
  final Project project = aPackage.getProject();
  ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY);
  if (map == null) {
    final ConcurrentWeakHashMap<PsiPackage, Boolean> newMap = new ConcurrentWeakHashMap<PsiPackage, Boolean>();
    map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
    if (map == newMap) {
      ((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
        @Override
        public void run() {
          newMap.clear();
        }
      });
    }
  }

  Boolean ret = map.get(aPackage);
  if (ret != null) return ret;
  ret = scanPackages(aPackage, 1);
  map.put(aPackage, ret);
  return ret;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:TreeViewUtil.java


示例3: LoaderFactory

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
public LoaderFactory(final Project project) {
  myProject = project;
  myModule2ClassLoader = new ConcurrentWeakHashMap<Module, ClassLoader>();
  myConnection = myProject.getMessageBus().connect();
  myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    public void rootsChanged(final ModuleRootEvent event) {
      clearClassLoaderCache();
    }
  });

  Disposer.register(project, new Disposable() {
    public void dispose() {
      myConnection.disconnect();
      myModule2ClassLoader.clear();
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:LoaderFactory.java


示例4: getFieldsToFix

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
@NotNull
private Collection<SmartPsiElementPointer<PsiField>> getFieldsToFix() {
  Map<SmartPsiElementPointer<PsiField>, Boolean> fields = myClass.getUserData(FIELDS);
  if (fields == null) myClass.putUserData(FIELDS, fields = new ConcurrentWeakHashMap<SmartPsiElementPointer<PsiField>,Boolean>(1));
  final Map<SmartPsiElementPointer<PsiField>, Boolean> finalFields = fields;
  return new AbstractCollection<SmartPsiElementPointer<PsiField>>() {
    @Override
    public boolean add(SmartPsiElementPointer<PsiField> psiVariable) {
      PsiField field = psiVariable.getElement();
      if (field == null || !isAvailable(field)) return false;
      return finalFields.put(psiVariable, Boolean.TRUE) == null;
    }

    @Override
    public Iterator<SmartPsiElementPointer<PsiField>> iterator() {
      return finalFields.keySet().iterator();
    }

    @Override
    public int size() {
      return finalFields.size();
    }

    @Override
    public void clear() {
      finalFields.clear();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:CreateConstructorParameterFromFieldFix.java


示例5: getUnboundedParams

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
@NotNull
private static Collection<SmartPsiElementPointer<PsiParameter>> getUnboundedParams(PsiMethod psiMethod) {
  Map<SmartPsiElementPointer<PsiParameter>, Boolean> params = psiMethod.getUserData(PARAMS);
  if (params == null) psiMethod.putUserData(PARAMS, params = new ConcurrentWeakHashMap<SmartPsiElementPointer<PsiParameter>, Boolean>(1));
  final Map<SmartPsiElementPointer<PsiParameter>, Boolean> finalParams = params;
  return new AbstractCollection<SmartPsiElementPointer<PsiParameter>>() {
    @Override
    public boolean add(SmartPsiElementPointer<PsiParameter> psiVariable) {
      return finalParams.put(psiVariable, Boolean.TRUE) == null;
    }

    @Override
    public Iterator<SmartPsiElementPointer<PsiParameter>> iterator() {
      return finalParams.keySet().iterator();
    }

    @Override
    public int size() {
      return finalParams.size();
    }

    @Override
    public void clear() {
      finalParams.clear();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:BindFieldsFromParametersAction.java


示例6: xmlFileWasChanged

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private boolean xmlFileWasChanged(VirtualFile xmlFile, VFileEvent event) {
  if (!xmlFile.isValid() || !(event instanceof VFileContentChangeEvent)) return true;

  ConcurrentWeakHashMap<Project, Integer> map = xmlFile.getUserData(CRC_WITHOUT_SPACES);
  if (map == null) {
    map = xmlFile.putUserDataIfAbsent(CRC_WITHOUT_SPACES, new ConcurrentWeakHashMap<Project, Integer>());
  }

  Integer crc = map.get(myProject);
  Integer newCrc;

  try {
    newCrc = MavenUtil.crcWithoutSpaces(xmlFile);
  }
  catch (IOException ignored) {
    return true;
  }

  if (newCrc == -1 // XML is invalid
      || newCrc.equals(crc)) {
    return false;
  }
  else {
    map.put(myProject, newCrc);
    return true;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:MavenProjectsManagerWatcher.java


示例7: getTrackedIgnoredFiles

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
/**
 * Helper method to return tracked and ignored files map.
 *
 * @param event current event
 * @return map of files
 */
private ConcurrentMap<VirtualFile, VcsRoot> getTrackedIgnoredFiles(@NotNull AnActionEvent event) {
    final Project project = event.getProject();

    if (project != null) {
        return IgnoreManager.getInstance(project).getConfirmedIgnoredFiles();
    }

    return new ConcurrentWeakHashMap<VirtualFile, VcsRoot>();
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:16,代码来源:HandleTrackedIgnoredFilesAction.java


示例8: createWeakMap

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private static <K,V> ConcurrentWeakHashMap<K, V> createWeakMap() {
  return new ConcurrentWeakHashMap<K,V>(100, 0.75f, Runtime.getRuntime().availableProcessors(), ContainerUtil.<K>canonicalStrategy());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:ResolveCache.java


示例9: createWeakMap

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private static <K, V> ConcurrentWeakHashMap<K, V> createWeakMap() {
  return new ConcurrentWeakHashMap<K, V>(7, 0.75f, Runtime.getRuntime().availableProcessors(),
                                        TObjectHashingStrategy.CANONICAL);
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:5,代码来源:HaxeClassResolveCache.java


示例10: CachedConcurrentMap

import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
/**
 * Default constructor.
 *
 * @param fetcher data fetcher
 */
private CachedConcurrentMap(@NotNull DataFetcher<K, V> fetcher) {
    this.map = new ConcurrentWeakHashMap<K, V>();
    this.fetcher = fetcher;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:10,代码来源:CachedConcurrentMap.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ThrottledContentObserver类代码示例发布时间:1970-01-01
下一篇:
Java S3CPacketUpdateScore类代码示例发布时间:1970-01-01
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap