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


Java HashMap.containsKey方法代码示例

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


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

示例1: findConstructorUsages

import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@Nullable
private static Condition<PsiElement> findConstructorUsages(PsiMethod constructor, Collection<PsiReference> originalReferences, List<UsageInfo> usages,
                                                           final PsiElement[] allElementsToDelete) {
  HashMap<PsiMethod, Collection<PsiReference>> constructorsToRefs = new HashMap<PsiMethod, Collection<PsiReference>>();
  HashSet<PsiMethod> newConstructors = new HashSet<PsiMethod>();
  if (isTheOnlyEmptyDefaultConstructor(constructor)) return null;

  newConstructors.add(constructor);
  constructorsToRefs.put(constructor, originalReferences);
  HashSet<PsiMethod> passConstructors = new HashSet<PsiMethod>();
  do {
    passConstructors.clear();
    for (PsiMethod method : newConstructors) {
      final Collection<PsiReference> references = constructorsToRefs.get(method);
      for (PsiReference reference : references) {
        PsiMethod overridingConstructor = getOverridingConstructorOfSuperCall(reference.getElement());
        if (overridingConstructor != null && !constructorsToRefs.containsKey(overridingConstructor)) {
          Collection<PsiReference> overridingConstructorReferences = ReferencesSearch.search(overridingConstructor).findAll();
          constructorsToRefs.put(overridingConstructor, overridingConstructorReferences);
          passConstructors.add(overridingConstructor);
        }
      }
    }
    newConstructors.clear();
    newConstructors.addAll(passConstructors);
  }
  while(!newConstructors.isEmpty());

  final Set<PsiMethod> validOverriding =
          validateOverridingMethods(constructor, originalReferences, constructorsToRefs.keySet(), constructorsToRefs, usages,
                                    allElementsToDelete);

  return new Condition<PsiElement>() {
    public boolean value(PsiElement usage) {
      if(usage instanceof PsiFile) return false;
      return isInside(usage, allElementsToDelete) || isInside(usage, validOverriding);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:JavaSafeDeleteProcessor.java

示例2: sortUsages

import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
/**
 * @param usages
 * @return Map from elements to UsageHolders
 */
private static HashMap<PsiElement,UsageHolder> sortUsages(@NotNull UsageInfo[] usages) {
  HashMap<PsiElement,UsageHolder> result = new HashMap<PsiElement, UsageHolder>();

  for (final UsageInfo usage : usages) {
    if (usage instanceof SafeDeleteUsageInfo) {
      final PsiElement referencedElement = ((SafeDeleteUsageInfo)usage).getReferencedElement();
      if (!result.containsKey(referencedElement)) {
        result.put(referencedElement, new UsageHolder(referencedElement, usages));
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SafeDeleteProcessor.java

示例3: buildRootsToFilesMap

import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
private Map<CvsRootProvider, ArrayList<File>> buildRootsToFilesMap() throws CannotFindCvsRootException {
  HashMap<CvsRootProvider,ArrayList<File>> result = new HashMap<CvsRootProvider, ArrayList<File>>();
  for (File file : myFiles) {
    CvsRootProvider cvsRoot = CvsRootProvider.createOn(file);
    if (cvsRoot == null) {
      throw new CannotFindCvsRootException(file);
    }
    else {
      if (!result.containsKey(cvsRoot)) result.put(cvsRoot, new ArrayList<File>());
      (result.get(cvsRoot)).add(file);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CvsOperationOnFiles.java


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