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


Java HashSet类代码示例

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


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

示例1: findClassFqns

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
private void findClassFqns( @NotNull HashSet<String> dest, ManModule start, ManModule module )
{
  for( ITypeManifold tm: module.getTypeManifolds() )
  {
    if( tm.getProducerKind() == ITypeManifold.ProducerKind.Supplemental )
    {
      continue;
    }
    dest.addAll( tm.getAllTypeNames().stream().map( ClassUtil::extractClassName ).collect( Collectors.toList() ) );
  }
  for( Dependency d : module.getDependencies() )
  {
    if( module == start || d.isExported() )
    {
      findClassFqns( dest, start, (ManModule)d.getModule() );
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:19,代码来源:ManShortNamesCache.java

示例2: resetSelection

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
private void resetSelection(@NotNull String[] selectedSerials) {
  MyDeviceTableModel model = (MyDeviceTableModel)myDeviceTable.getModel();
  Set<String> selectedSerialsSet = new HashSet<String>();
  Collections.addAll(selectedSerialsSet, selectedSerials);
  IDevice[] myDevices = model.myDevices;
  ListSelectionModel selectionModel = myDeviceTable.getSelectionModel();
  boolean cleared = false;

  for (int i = 0, n = myDevices.length; i < n; i++) {
    String serialNumber = myDevices[i].getSerialNumber();
    if (selectedSerialsSet.contains(serialNumber)) {
      if (!cleared) {
        selectionModel.clearSelection();
        cleared = true;
      }
      selectionModel.addSelectionInterval(i, i);
    }
  }
}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:20,代码来源:MyDeviceChooser.java

示例3: excludeAllBuildConfigsFromCompilation

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
private static void excludeAllBuildConfigsFromCompilation(AndroidFacet facet, VirtualFile sourceRoot) {
  final Module module = facet.getModule();
  final Project project = module.getProject();
  final Set<String> packages = new HashSet<String>();

  final Manifest manifest = facet.getManifest();
  final String aPackage = manifest != null ? manifest.getPackage().getStringValue() : null;

  if (aPackage != null) {
    packages.add(aPackage);
  }
  packages.addAll(AndroidUtils.getDepLibsPackages(module));

  for (String p : packages) {
    excludeFromCompilation(project, sourceRoot, p);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidCompileUtil.java

示例4: getSelectedPsiElements

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
@NotNull
private PsiElement[] getSelectedPsiElements() {
  final TreePath[] treePaths = myTree.getSelectionPaths();
  if (treePaths != null) {
    Set<PsiElement> result = new HashSet<PsiElement>();
    for (TreePath path : treePaths) {
      final Object component = path.getLastPathComponent();
      if (component instanceof PackageDependenciesNode) {
        PackageDependenciesNode node = (PackageDependenciesNode)component;
        final PsiElement psiElement = node.getPsiElement();
        if (psiElement != null && psiElement.isValid()) {
          result.add(psiElement);
        }
      }
    }
    return PsiUtilCore.toPsiElementArray(result);
  }
  return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ScopeTreeViewPanel.java

示例5: getJava8Modules

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
@NotNull
private static Set<Module> getJava8Modules(Project project) {
  final boolean projectLevelIsHigh = PsiUtil.getLanguageLevel(project).isAtLeast(LanguageLevel.JDK_1_8);

  final Set<Module> highLevelModules = new HashSet<Module>();
  for (Module module : ModuleManager.getInstance(project).getModules()) {
    final LanguageLevelModuleExtension extension = ModuleRootManager.getInstance(module).getModuleExtension(LanguageLevelModuleExtension.class);
    if (extension != null) {
      final LanguageLevel level = extension.getLanguageLevel();
      if (level == null && projectLevelIsHigh || level != null && level.isAtLeast(LanguageLevel.JDK_1_8)) {
        highLevelModules.add(module);
      }
    }
  }
  return highLevelModules;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFunctionalExpressionSearcher.java

示例6: convertToGlobalScope

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
@NotNull
private static GlobalSearchScope convertToGlobalScope(Project project, SearchScope useScope) {
  final GlobalSearchScope scope;
  if (useScope instanceof GlobalSearchScope) {
    scope = (GlobalSearchScope)useScope;
  }
  else if (useScope instanceof LocalSearchScope) {
    final Set<VirtualFile> files = new HashSet<VirtualFile>();
    addAllNotNull(files, map(((LocalSearchScope)useScope).getScope(), new Function<PsiElement, VirtualFile>() {
      @Override
      public VirtualFile fun(PsiElement element) {
        return PsiUtilCore.getVirtualFile(element);
      }
    }));
    scope = GlobalSearchScope.filesScope(project, files);
  }
  else {
    scope = new EverythingGlobalScope(project);
  }
  return scope;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaFunctionalExpressionSearcher.java

示例7: isMethodEquivalentTo

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
public static boolean isMethodEquivalentTo(@NotNull PsiMethod method1, PsiElement another) {
  if (method1 == another) return true;
  if (!(another instanceof PsiMethod)) return false;
  PsiMethod method2 = (PsiMethod)another;
  if (!another.isValid()) return false;
  if (!method1.getName().equals(method2.getName())) return false;
  PsiClass aClass1 = method1.getContainingClass();
  PsiClass aClass2 = method2.getContainingClass();
  PsiManager manager = method1.getManager();
  if (!(aClass1 != null && aClass2 != null && manager.areElementsEquivalent(aClass1, aClass2))) return false;

  PsiParameter[] parameters1 = method1.getParameterList().getParameters();
  PsiParameter[] parameters2 = method2.getParameterList().getParameters();
  if (parameters1.length != parameters2.length) return false;
  for (int i = 0; i < parameters1.length; i++) {
    PsiParameter parameter1 = parameters1[i];
    PsiParameter parameter2 = parameters2[i];
    PsiType type1 = parameter1.getType();
    PsiType type2 = parameter2.getType();
    if (!compareParamTypes(manager, type1, type2, new HashSet<String>())) return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PsiClassImplUtil.java

示例8: CloudModuleWizardStep

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
public CloudModuleWizardStep(CloudModuleBuilder moduleBuilder, Project project, Disposable parentDisposable) {
  myModuleBuilder = moduleBuilder;
  myProject = project;
  myParentDisposable = parentDisposable;

  myApplicationConfigurableTypes = new HashSet<ServerType<?>>();

  List<ServerType<?>> cloudTypes = new ArrayList<ServerType<?>>();
  for (CloudModuleBuilderContributionFactory contribution : CloudModuleBuilderContributionFactory.EP_NAME.getExtensions()) {
    cloudTypes.add(contribution.getCloudType());
  }

  myAccountSelectionPanel = new CloudAccountSelectionEditor(cloudTypes);
  myAccountPanelPlaceHolder.add(myAccountSelectionPanel.getMainPanel());

  myAccountSelectionPanel.setAccountSelectionListener(new Runnable() {

    @Override
    public void run() {
      onAccountSelectionChanged();
    }
  });
  onAccountSelectionChanged();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:CloudModuleWizardStep.java

示例9: notNullParamEquation

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
final Equation<Key, Value> notNullParamEquation(int i, boolean stable) {
  final Key key = new Key(method, new In(i, In.NOT_NULL_MASK), stable);
  final Result<Key, Value> result;
  if (interpreter.dereferencedParams[i]) {
    result = new Final<Key, Value>(Value.NotNull);
  }
  else {
    Set<ParamKey> calls = interpreter.parameterFlow[i];
    if (calls == null || calls.isEmpty()) {
      result = new Final<Key, Value>(Value.Top);
    }
    else {
      Set<Key> keys = new HashSet<Key>();
      for (ParamKey pk: calls) {
        keys.add(new Key(pk.method, new In(pk.i, In.NOT_NULL_MASK), pk.stable));
      }
      result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys)));
    }
  }
  return new Equation<Key, Value>(key, result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:Combined.java

示例10: nullableParamEquation

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
final Equation<Key, Value> nullableParamEquation(int i, boolean stable) {
  final Key key = new Key(method, new In(i, In.NULLABLE_MASK), stable);
  final Result<Key, Value> result;
  if (interpreter.dereferencedParams[i] || interpreter.notNullableParams[i] || returnValue instanceof NthParamValue && ((NthParamValue)returnValue).n == i) {
    result = new Final<Key, Value>(Value.Top);
  }
  else {
    Set<ParamKey> calls = interpreter.parameterFlow[i];
    if (calls == null || calls.isEmpty()) {
      result = new Final<Key, Value>(Value.Null);
    }
    else {
      Set<Product<Key, Value>> sum = new HashSet<Product<Key, Value>>();
      for (ParamKey pk: calls) {
        sum.add(new Product<Key, Value>(Value.Top, Collections.singleton(new Key(pk.method, new In(pk.i, In.NULLABLE_MASK), pk.stable))));
      }
      result = new Pending<Key, Value>(sum);
    }
  }
  return new Equation<Key, Value>(key, result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:Combined.java

示例11: contractEquation

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
final Equation<Key, Value> contractEquation(int i, Value inValue, boolean stable) {
  final Key key = new Key(method, new InOut(i, inValue), stable);
  final Result<Key, Value> result;
  HashSet<Key> keys = new HashSet<Key>();
  for (int argI = 0; argI < conditionValue.args.size(); argI++) {
    BasicValue arg = conditionValue.args.get(argI);
    if (arg instanceof NthParamValue) {
      NthParamValue npv = (NthParamValue)arg;
      if (npv.n == i) {
        keys.add(new Key(conditionValue.method, new InOut(argI, inValue), conditionValue.stableCall, true));
      }
    }
  }
  if (keys.isEmpty()) {
    result = new Final<Key, Value>(Value.Top);
  } else {
    result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys)));
  }
  return new Equation<Key, Value>(key, result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:Combined.java

示例12: getSourceRootsForModuleAndDependencies

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
@NotNull
public static File[] getSourceRootsForModuleAndDependencies(@NotNull JpsModule rootModule) {
  final Set<File> result = new HashSet<File>();

  for (JpsModule module : getRuntimeModuleDeps(rootModule)) {
    final JpsAndroidModuleExtension extension = getExtension(module);
    File resDir = null;
    File resDirForCompilation = null;

    if (extension != null) {
      resDir = extension.getResourceDir();
      resDirForCompilation = extension.getResourceDirForCompilation();
    }

    for (JpsModuleSourceRoot root : module.getSourceRoots()) {
      final File rootDir = JpsPathUtil.urlToFile(root.getUrl());

      if ((JavaSourceRootType.SOURCE.equals(root.getRootType())
           || JavaSourceRootType.TEST_SOURCE.equals(root.getRootType()) && extension != null && extension.isPackTestCode())
          && !FileUtil.filesEqual(rootDir, resDir) && !rootDir.equals(resDirForCompilation)) {
        result.add(rootDir);
      }
    }
  }
  return result.toArray(new File[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidJpsUtil.java

示例13: appendTestClass

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
private void appendTestClass(PsiClass aClass, String testSuffix, final GlobalSearchScope moduleScope) {
  PsiShortNamesCache cache = PsiShortNamesCache.getInstance(aClass.getProject());

  String klassName = aClass.getName();
  Pattern pattern = Pattern.compile(".*" + klassName + ".*" + testSuffix);

  HashSet<String> names = new HashSet<String>();
  cache.getAllClassNames(names);
  for (String eachName : names) {
    if (pattern.matcher(eachName).matches()) {
      for (PsiClass eachClass : cache.getClassesByName(eachName, moduleScope)) {
        if (TestFrameworks.getInstance().isTestClass(eachClass)) {
          myElements.add(eachClass);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AutomaticTestRenamerFactory.java

示例14: findNodeForPsiElement

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
@Nullable
public static PackageDependenciesNode[] findNodeForPsiElement(PackageDependenciesNode parent, PsiElement element){
  final Set<PackageDependenciesNode> result = new HashSet<PackageDependenciesNode>();
  for (int i = 0; i < parent.getChildCount(); i++){
    final TreeNode treeNode = parent.getChildAt(i);
    if (treeNode instanceof PackageDependenciesNode){
      final PackageDependenciesNode node = (PackageDependenciesNode)treeNode;
      if (element instanceof PsiDirectory && node.getPsiElement() == element){
        return new PackageDependenciesNode[] {node};
      }
      if (element instanceof PsiFile) {
        PsiFile psiFile = null;
        if (node instanceof BasePsiNode) {
          psiFile = ((BasePsiNode)node).getContainingFile();
        }
        else if (node instanceof FileNode) { //non java files
          psiFile = ((PsiFile)node.getPsiElement());
        }
        if (psiFile != null && Comparing.equal(psiFile.getVirtualFile(), ((PsiFile)element).getVirtualFile())) {
          result.add(node);
        }
      }
    }
  }
  return result.isEmpty() ? null : result.toArray(new PackageDependenciesNode[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FileTreeModelBuilder.java

示例15: checkFilesAreInList

import com.intellij.util.containers.HashSet; //导入依赖的package包/类
/**
 * Updates the change list manager and checks that the given files are in the default change list.
 * @param only Set this to true if you want ONLY the specified files to be in the change list.
 *             If set to false, the change list may contain some other files apart from the given ones.
 * @param files Files to be checked.
 */
public void checkFilesAreInList(boolean only, VirtualFile... files) {
  ensureUpToDate();

  final Collection<Change> changes = peer.getDefaultChangeList().getChanges();
  if (only) {
    Assert.assertEquals(changes.size(), files.length);
  }
  final Collection<VirtualFile> filesInChangeList = new HashSet<VirtualFile>();
  for (Change c : changes) {
    filesInChangeList.add(c.getVirtualFile());
  }
  for (VirtualFile f : files) {
    Assert.assertTrue(filesInChangeList.contains(f));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:HgTestChangeListManager.java


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