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


Java HashSet类代码示例

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


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


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