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

Java HashSet类代码示例

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

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



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

示例1: provideNodes

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(@NotNull TreeElement node) {
  if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
    final PsiElement el = ((PsiTreeElementBase)node).getElement();
    if (el != null) {
      for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
        final PsiElement[] elements = provider.getAnonymousElements(el);
        if (elements.length > 0) {
          List<JavaAnonymousClassTreeElement> result = new ArrayList<JavaAnonymousClassTreeElement>(elements.length);
          for (PsiElement element : elements) {
            result.add(new JavaAnonymousClassTreeElement((PsiAnonymousClass)element, new HashSet<PsiClass>()));
          }
          return result;
        }
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaAnonymousClassesNodeProvider.java


示例2: searchStringExpressions

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
public static Set<Pair<PsiElement, String>> searchStringExpressions(@NotNull final PsiMethod psiMethod,
                                                                    @NotNull SearchScope searchScope,
                                                                    int expNum) {
  Set<Pair<PsiElement, String>> pairs = new com.intellij.util.containers.HashSet<Pair<PsiElement, String>>();
  for (PsiMethodCallExpression methodCallExpression : searchMethodCalls(psiMethod, searchScope)) {
    final PsiExpression[] expressions = methodCallExpression.getArgumentList().getExpressions();
    if (expressions.length > expNum) {
      final PsiExpression expression = expressions[expNum];
      Pair<PsiElement, String> pair = evaluateExpression(expression);
      if (pair != null) {
        pairs.add(pair);
      }
    }
  }

  return pairs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:StringExpressionHelper.java


示例3: searchMethodCalls

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
public static Set<PsiMethodCallExpression> searchMethodCalls(@NotNull final PsiMethod psiMethod, @NotNull SearchScope searchScope) {
  final Set<PsiMethodCallExpression> callExpressions = new com.intellij.util.containers.HashSet<PsiMethodCallExpression>();
  final CommonProcessors.CollectUniquesProcessor<PsiReference> consumer = new CommonProcessors.CollectUniquesProcessor<PsiReference>();

  MethodReferencesSearch.search(psiMethod, searchScope, true).forEach(consumer);

  for (PsiReference psiReference : consumer.getResults()) {
    final PsiMethodCallExpression methodCallExpression =
      PsiTreeUtil.getParentOfType(psiReference.getElement(), PsiMethodCallExpression.class);

    if (methodCallExpression != null) {
      callExpressions.add(methodCallExpression);
    }
  }


  return callExpressions;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StringExpressionHelper.java


示例4: dispose

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@Override
public void dispose() {
  assertWritable();
  ApplicationManager.getApplication().assertWriteAccessAllowed();
  final Set<Module> set = new HashSet<Module>();
  set.addAll(myModuleModel.myModules.values());
  for (Module thisModule : myModules.values()) {
    if (!set.contains(thisModule)) {
      Disposer.dispose(thisModule);
    }
  }
  for (Module moduleToDispose : myModulesToDispose) {
    if (!set.contains(moduleToDispose)) {
      Disposer.dispose(moduleToDispose);
    }
  }
  clearRenamingStuff();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ModuleManagerImpl.java


示例5: buildFoldRegions

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
@Override
public final FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
  List<FoldingDescriptor> descriptors = new ArrayList<FoldingDescriptor>();
  ourCustomRegionElements.set(new HashSet<ASTNode>());
  try {
    if (CustomFoldingProvider.getAllProviders().length > 0) {
      myDefaultProvider = null;
      ASTNode rootNode = root.getNode();
      if (rootNode != null) {
        addCustomFoldingRegionsRecursively(new FoldingStack(rootNode), rootNode, descriptors, 0);
      }
    }
    buildLanguageFoldRegions(descriptors, root, document, quick);
  }
  finally {
    ourCustomRegionElements.set(null);
  }
  return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CustomFoldingBuilder.java


示例6: getUsages

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
public static Set<UsageDescriptor> getUsages(@NotNull IdeSettingsDescriptor descriptor, @NotNull Object componentInstance) {
  Set<UsageDescriptor> descriptors = new HashSet<UsageDescriptor>();

  String providerName = descriptor.myProviderName;

  List<String> propertyNames = descriptor.getPropertyNames();
  if (providerName != null && propertyNames.size() > 0) {
      for (String propertyName : propertyNames) {
        Object propertyValue = getPropertyValue(componentInstance, propertyName);

        if (propertyValue != null) {
          descriptors.add(new UsageDescriptor(getUsageDescriptorKey(providerName, propertyName, propertyValue.toString()), 1));
        }
    }
  }
  return descriptors;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:IdeSettingsStatisticsUtils.java


示例7: filterUsages

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
protected List<UsageInfo> filterUsages(List<UsageInfo> infos) {
  Map<PsiElement, MoveRenameUsageInfo> moveRenameInfos = new HashMap<PsiElement, MoveRenameUsageInfo>();
  Set<PsiElement> usedElements = new HashSet<PsiElement>();

  List<UsageInfo> result = new ArrayList<UsageInfo>(infos.size() / 2);
  for (UsageInfo info : infos) {
    LOG.assertTrue(info != null, getClass());
    PsiElement element = info.getElement();
    if (info instanceof MoveRenameUsageInfo) {
      if (usedElements.contains(element)) continue;
      moveRenameInfos.put(element, (MoveRenameUsageInfo)info);
    }
    else {
      moveRenameInfos.remove(element);
      usedElements.add(element);
      if (!(info instanceof PossiblyIncorrectUsage) || ((PossiblyIncorrectUsage)info).isCorrect()) {
        result.add(info);
      }
    }
  }
  result.addAll(moveRenameInfos.values());
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ChangeSignatureProcessorBase.java


示例8: addProblem

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
private static void addProblem(@NotNull MavenDomDependency dependency,
                               @NotNull Collection<MavenDomDependency> dependencies,
                               @NotNull DomElementAnnotationHolder holder) {
  StringBuilder sb = new StringBuilder();
  Set<MavenDomProjectModel> processed = new HashSet<MavenDomProjectModel>();
  for (MavenDomDependency domDependency : dependencies) {
    if (dependency.equals(domDependency)) continue;
    MavenDomProjectModel model = domDependency.getParentOfType(MavenDomProjectModel.class, false);
    if (model != null && !processed.contains(model)) {
      if (processed.size() > 0) sb.append(", ");
      sb.append(createLinkText(model, domDependency));

      processed.add(model);
    }
  }
  holder.createProblem(dependency, HighlightSeverity.WARNING,
                       MavenDomBundle.message("MavenDuplicateDependenciesInspection.has.duplicates", sb.toString()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenDuplicateDependenciesInspection.java


示例9: collectProperties

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
public static Set<XmlTag> collectProperties(@NotNull MavenDomProjectModel projectDom, @NotNull final Project project) {
  final Set<XmlTag> properties = new HashSet<XmlTag>();

  Processor<MavenDomProperties> collectProcessor = new Processor<MavenDomProperties>() {
    public boolean process(MavenDomProperties mavenDomProperties) {
      XmlTag propertiesTag = mavenDomProperties.getXmlTag();
      if (propertiesTag != null) {
        ContainerUtil.addAll(properties, propertiesTag.getSubTags());
      }
      return false;
    }
  };

  processProperties(projectDom, collectProcessor, project);

  return properties;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenDomProjectProcessorUtils.java


示例10: searchDependencyUsages

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
public static Set<MavenDomDependency> searchDependencyUsages(@NotNull final MavenDomProjectModel model,
                                                             @NotNull final DependencyConflictId dependencyId,
                                                             @NotNull final Set<MavenDomDependency> excludes) {
  Project project = model.getManager().getProject();
  final Set<MavenDomDependency> usages = new HashSet<MavenDomDependency>();
  Processor<MavenDomProjectModel> collectProcessor = new Processor<MavenDomProjectModel>() {
    public boolean process(MavenDomProjectModel mavenDomProjectModel) {
      for (MavenDomDependency domDependency : mavenDomProjectModel.getDependencies().getDependencies()) {
        if (excludes.contains(domDependency)) continue;

        if (dependencyId.equals(DependencyConflictId.create(domDependency))) {
          usages.add(domDependency);
        }
      }
      return false;
    }
  };

  processChildrenRecursively(model, collectProcessor, project, new HashSet<MavenDomProjectModel>(), true);

  return usages;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MavenDomProjectProcessorUtils.java


示例11: searchManagedPluginUsages

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
public static Collection<MavenDomPlugin> searchManagedPluginUsages(@NotNull final MavenDomProjectModel model,
                                                                   @Nullable final String groupId,
                                                                   @NotNull final String artifactId) {
  Project project = model.getManager().getProject();

  final Set<MavenDomPlugin> usages = new HashSet<MavenDomPlugin>();

  Processor<MavenDomProjectModel> collectProcessor = new Processor<MavenDomProjectModel>() {
    public boolean process(MavenDomProjectModel mavenDomProjectModel) {
      for (MavenDomPlugin domPlugin : mavenDomProjectModel.getBuild().getPlugins().getPlugins()) {
        if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) {
          usages.add(domPlugin);
        }
      }
      return false;
    }
  };

  processChildrenRecursively(model, collectProcessor, project, new HashSet<MavenDomProjectModel>(), true);

  return usages;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MavenDomProjectProcessorUtils.java


示例12: ApplicationLevelNumberConnectionsGuardImpl

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
public ApplicationLevelNumberConnectionsGuardImpl() {
  myDelay = DELAY;
  mySet = new HashSet<CachingSvnRepositoryPool>();
  myService = Executors.newSingleThreadScheduledExecutor(ConcurrencyUtil.newNamedThreadFactory("SVN connection"));
  myLock = new Object();
  myDisposed = false;
  myRecheck = new Runnable() {
    @Override
    public void run() {
      HashSet<CachingSvnRepositoryPool> pools = new HashSet<CachingSvnRepositoryPool>();
      synchronized (myLock) {
        pools.addAll(mySet);
      }
      for (CachingSvnRepositoryPool pool : pools) {
        pool.check();
      }
    }
  };
  myCurrentlyActiveConnections = 0;
  myCurrentlyOpenedConnections = 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ApplicationLevelNumberConnectionsGuardImpl.java


示例13: waitForTotalNumberOfConnectionsOk

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@Override
public void waitForTotalNumberOfConnectionsOk() throws SVNException {
  synchronized (myLock) {
    if (myCurrentlyActiveConnections >= CachingSvnRepositoryPool.ourMaxTotal) {
      waitForFreeConnections();
    }
  }
  // maybe too many opened? reduce request
  final Set<CachingSvnRepositoryPool> copy = new HashSet<CachingSvnRepositoryPool>();
  synchronized (myLock) {
    if (myCurrentlyOpenedConnections >= CachingSvnRepositoryPool.ourMaxTotal) {
      copy.addAll(mySet);
    }
  }
  for (CachingSvnRepositoryPool pool : copy) {
    pool.closeInactive();
  }
  synchronized (myLock) {
    waitForFreeConnections();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ApplicationLevelNumberConnectionsGuardImpl.java


示例14: RepoGroup

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
private RepoGroup(ThrowableConvertor<SVNURL, SVNRepository, SVNException> creator, int cached, int concurrent,
                  final ThrowableConsumer<Pair<SVNURL, SVNRepository>, SVNException> adjuster,
                  final ApplicationLevelNumberConnectionsGuard guard, final Object waitObj, final long connectionTimeout) {
  myCreator = creator;
  myMaxCached = cached;
  myMaxConcurrent = concurrent;
  myAdjuster = adjuster;
  myGuard = guard;
  myConnectionTimeout = connectionTimeout;

  myInactive = new TreeMap<Long, SVNRepository>();
  myUsed = new HashSet<SVNRepository>();

  myDisposed = false;
  myWait = waitObj;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CachingSvnRepositoryPool.java


示例15: collectMethods

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@Override
public void collectMethods(@NotNull final GrTypeDefinition clazz, @NotNull Collection<PsiMethod> collector) {
  Set<PsiClass> processed = new HashSet<PsiClass>();

  if (!checkForDelegate(clazz)) return;

  Map<MethodSignature, PsiMethod> signatures = new THashMap<MethodSignature, PsiMethod>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY);
  initializeSignatures(clazz, PsiSubstitutor.EMPTY, signatures, processed);

  List<PsiMethod> methods = new ArrayList<PsiMethod>();
  process(clazz, PsiSubstitutor.EMPTY, true, new HashSet<PsiClass>(), processed, methods, clazz, false);

  final Set<PsiMethod> result = new LinkedHashSet<PsiMethod>();
  for (PsiMethod method : methods) {
    addMethodChecked(signatures, method, PsiSubstitutor.EMPTY, result);
  }

  collector.addAll(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DelegatedMethodsContributor.java


示例16: filterOutReflectedMethods

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
private static void filterOutReflectedMethods(List toShow) {
  Set<GrMethod> methods = new HashSet<GrMethod>();

  for (Iterator iterator = toShow.iterator(); iterator.hasNext(); ) {
    Object next = iterator.next();
    if (next instanceof GroovyResolveResult) {
      final PsiElement element = ((GroovyResolveResult)next).getElement();
      if (element instanceof GrReflectedMethod) {
        final GrMethod base = ((GrReflectedMethod)element).getBaseMethod();
        if (!methods.add(base)) {
          iterator.remove();
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GroovyParameterInfoHandler.java


示例17: addAllRestrictedProperties

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@NotNull
private Set<String> addAllRestrictedProperties() {
  if (myRefExpr.getQualifier() != null) {
    return Collections.emptySet();
  }

  Set<String> propertyNames = new HashSet<String>();
  for (GrTypeDefinition containingClass = PsiTreeUtil.getParentOfType(myRefExpr, GrTypeDefinition.class);
       containingClass != null;
       containingClass = PsiTreeUtil.getParentOfType(containingClass, GrTypeDefinition.class)) {
    for (PsiField field : containingClass.getFields()) {
      propertyNames.add(field.getName());
    }
  }
  return propertyNames;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CompleteReferenceExpression.java


示例18: getNewFileName

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
private static String getNewFileName(GroovyFile file) {
  final PsiDirectory dir = file.getContainingDirectory();
  LOG.assertTrue(dir != null);


  final PsiFile[] files = dir.getFiles();
  Set<String> fileNames = new HashSet<String>();
  for (PsiFile psiFile : files) {
    fileNames.add(psiFile.getName());
  }
  String prefix = FileUtil.getNameWithoutExtension(file.getName());
  String fileName = prefix + ".java";
  int index = 1;
  while (fileNames.contains(fileName)) {
    fileName = prefix + index + ".java";
  }
  return fileName;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ConvertToJavaProcessor.java


示例19: getVarTypes

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
static Set<String> getVarTypes(GrVariableDeclaration variableDeclaration) {
  GrVariable[] variables = variableDeclaration.getVariables();
  final GrTypeElement typeElement = variableDeclaration.getTypeElementGroovy();
  Set<String> types = new HashSet<String>(variables.length);
  if (typeElement == null) {
    if (variables.length > 1) {
      for (GrVariable variable : variables) {
        final GrExpression initializer = variable.getInitializerGroovy();
        if (initializer != null) {
          final PsiType varType = initializer.getType();
          if (varType != null) {
            types.add(getTypeText(varType, variableDeclaration));
          }
        }
      }
    }
  }
  return types;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GenerationUtil.java


示例20: provideNodes

import com.intellij.util.containers.hash.HashSet; //导入依赖的package包/类
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(TreeElement node) {
  if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
    final PsiElement el = ((PsiTreeElementBase)node).getElement();
    for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
      final PsiElement[] elements = provider.getAnonymousElements(el);
      if (elements != null && elements.length > 0) {
        List<JavaAnonymousClassTreeElement> result = new ArrayList<JavaAnonymousClassTreeElement>(elements.length);
        for (PsiElement element : elements) {
          result.add(new JavaAnonymousClassTreeElement((PsiAnonymousClass)element, new HashSet<PsiClass>()));
        }
        return result;
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:JavaAnonymousClassesNodeProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java GuiUtilRenderComponents类代码示例发布时间:2022-05-22
下一篇:
Java ConfigurableEmitter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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