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


Java MultiMap.entrySet方法代码示例

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


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

示例1: stripAndMerge

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
boolean stripAndMerge(Collection<DfaMemoryStateImpl> group,
                           Function<DfaMemoryStateImpl, DfaMemoryStateImpl> stripper) {
  if (group.size() <= 1) return false;

  boolean hasMerges = false;
  MultiMap<DfaMemoryStateImpl, DfaMemoryStateImpl> strippedToOriginals = MultiMap.create();
  for (DfaMemoryStateImpl original : group) {
    strippedToOriginals.putValue(stripper.fun(original), original);
  }
  for (Map.Entry<DfaMemoryStateImpl, Collection<DfaMemoryStateImpl>> entry : strippedToOriginals.entrySet()) {
    Collection<DfaMemoryStateImpl> merged = entry.getValue();
    if (merged.size() > 1) {
      myRemovedStates.addAll(merged);
      myMerged.add(entry.getKey());
      hasMerges = true;
    }
  }
  return hasMerges;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StateMerger.java

示例2: buildVisitor

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
  return new SchemaVisitor() {
    @Override
    public void visitImports(@NotNull SchemaImports schemaTypeImports) {
      super.visitImports(schemaTypeImports);

      List<SchemaImportStatement> imports = schemaTypeImports.getImportStatementList();

      MultiMap<Qn, SchemaImportStatement> importsByQn = ImportsManager.getImportsByQn(imports);

      for (Map.Entry<Qn, Collection<SchemaImportStatement>> entry : importsByQn.entrySet()) {
        entry.getValue().stream()
            .filter(is -> entry.getValue().size() > 1)
            .forEach(is -> holder.registerProblem(is,
                InspectionBundle.message("import.duplicate.problem.descriptor"),
                OptimizeImportsQuickFix.INSTANCE));
      }
    }
  };
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:23,代码来源:DuplicateImportInspection.java

示例3: buildVisitor

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
  return new SchemaVisitor() {
    @Override
    public void visitImports(@NotNull SchemaImports schemaTypeImports) {
      super.visitImports(schemaTypeImports);

      List<SchemaImportStatement> imports = schemaTypeImports.getImportStatementList();
      MultiMap<Qn, SchemaImportStatement> importsByQn = ImportsManager.getImportsByQn(imports);

      for (Map.Entry<Qn, Collection<SchemaImportStatement>> entry : importsByQn.entrySet()) {
        entry.getValue().stream()
            .filter(is -> DEFAULT_IMPORTS_LIST.contains(entry.getKey()))
            .forEach(is -> holder.registerProblem(is,
                InspectionBundle.message("import.unnecessary.problem.descriptor"),
                ProblemHighlightType.LIKE_UNUSED_SYMBOL,
                OptimizeImportsQuickFix.INSTANCE));
      }
    }
  };
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:23,代码来源:UnnecessaryImportInspection.java

示例4: importData

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ModuleDependencyData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
  MultiMap<DataNode<ModuleData>, DataNode<ModuleDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
  for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> entry : byModule.entrySet()) {
    Module ideModule = modelsProvider.findIdeModule(entry.getKey().getData());
    if (ideModule == null) {
      LOG.warn(String.format(
        "Can't import module dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
        entry.getValue(), entry.getKey()
      ));
      continue;
    }
    importData(entry.getValue(), ideModule, modelsProvider);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ModuleDependencyDataService.java

示例5: importData

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ContentRootData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
  if (toImport.isEmpty()) {
    return;
  }

  MultiMap<DataNode<ModuleData>, DataNode<ContentRootData>> byModule = ExternalSystemApiUtil.groupBy(toImport, ProjectKeys.MODULE);
  for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ContentRootData>>> entry : byModule.entrySet()) {
    Module module = modelsProvider.findIdeModule(entry.getKey().getData());
    if (module == null) {
      LOG.warn(String.format(
        "Can't import content roots. Reason: target module (%s) is not found at the ide. Content roots: %s",
        entry.getKey(), entry.getValue()
      ));
      continue;
    }
    importData(modelsProvider, entry.getValue(), module);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ContentRootDataService.java

示例6: importData

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
  if (toImport.isEmpty()) {
    return;
  }

  MultiMap<DataNode<ModuleData>, DataNode<LibraryDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
  for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
    Module module = modelsProvider.findIdeModule(entry.getKey().getData());
    if (module == null) {
      LOG.warn(String.format(
        "Can't import library dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
        entry.getValue(), entry.getKey()
      ));
      continue;
    }
    importData(entry.getValue(), module, modelsProvider);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryDependencyDataService.java

示例7: merge

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private void merge(MultiMap<Integer, Pair<Integer, TextDiffTypeEnum>> leftMap,
                   final Map<Integer, Pair<String, TextDiffTypeEnum>> whereTo) {
  for (Map.Entry<Integer, Collection<Pair<Integer, TextDiffTypeEnum>>> entry : leftMap.entrySet()) {
    List<Pair<Integer, TextDiffTypeEnum>> value = (List<Pair<Integer, TextDiffTypeEnum>>) entry.getValue();
    if (value.size() > 1) {
      Pair<Integer, TextDiffTypeEnum> pair1 = value.iterator().next();
      Pair<Integer, TextDiffTypeEnum> pair2 = value.get(value.size() - 1);
      TextDiffTypeEnum type = mergeDiffType(value);
      whereTo.put(entry.getKey(), Pair.create(String.valueOf(pair1.getFirst()) + "-" +
                                              String.valueOf(pair2.getFirst()), type));
    } else {
      Pair<Integer, TextDiffTypeEnum> pair = value.iterator().next();
      whereTo.put(entry.getKey(), Pair.create(String.valueOf(pair.getFirst()), pair.getSecond()));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NumberedFragmentHighlighter.java

示例8: processUnderFile

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private void processUnderFile(VirtualFile file) {
  final MultiMap<VirtualFile, FileAnnotation> annotations = new MultiMap<VirtualFile, FileAnnotation>();
  synchronized (myLock) {
    for (VirtualFile virtualFile : myFileAnnotationMap.keySet()) {
      if (VfsUtilCore.isAncestor(file, virtualFile, true)) {
        final Collection<FileAnnotation> values = myFileAnnotationMap.get(virtualFile);
        for (FileAnnotation value : values) {
          annotations.putValue(virtualFile, value);
        }
      }
    }
  }
  if (! annotations.isEmpty()) {
    for (Map.Entry<VirtualFile, Collection<FileAnnotation>> entry : annotations.entrySet()) {
      final VirtualFile key = entry.getKey();
      final VcsRevisionNumber number = fromDiffProvider(key);
      if (number == null) continue;
      final Collection<FileAnnotation> fileAnnotations = entry.getValue();
      for (FileAnnotation annotation : fileAnnotations) {
        if (annotation.isBaseRevisionChanged(number)) {
          annotation.close();
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:VcsAnnotationLocalChangesListenerImpl.java

示例9: initTree

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public void initTree(@NotNull MultiMap<String, PostfixTemplate> langToTemplates) {
  myRoot.removeAllChildren();
  for (Map.Entry<String, Collection<PostfixTemplate>> entry : langToTemplates.entrySet()) {
    String id = entry.getKey();
    Language language = Language.findLanguageByID(id);
    String langName = language != null ? language.getDisplayName() : id;  
    CheckedTreeNode langNode = new CheckedTreeNode(langName);
    myRoot.add(langNode);
    for (PostfixTemplate template : entry.getValue()) {
      CheckedTreeNode templateNode = new PostfixTemplateCheckedTreeNode(template, langName);
      langNode.add(templateNode);
    }
  }

  myModel.nodeStructureChanged(myRoot);
  TreeUtil.expandAll(this);
  setSelectionRow(0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PostfixTemplatesCheckboxTree.java

示例10: buildVisitor

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
  return new JsonElementVisitor() {
    @Override
    public void visitObject(@NotNull JsonObject o) {
      final MultiMap<String, PsiElement> keys = new MultiMap<String, PsiElement>();
      for (JsonProperty property : o.getPropertyList()) {
        keys.putValue(property.getName(), property.getNameElement());
      }
      for (Map.Entry<String, Collection<PsiElement>> entry : keys.entrySet()) {
        final Collection<PsiElement> sameNamedKeys = entry.getValue();
        if (sameNamedKeys.size() > 1) {
          for (PsiElement element : sameNamedKeys) {
            holder.registerProblem(element, JsonBundle.message("inspection.duplicate.keys.msg.duplicate.keys", entry.getKey()));
          }
        }
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JsonDuplicatePropertyKeysInspection.java

示例11: patchGroupsToOneGroup

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static List<FilePatch> patchGroupsToOneGroup(MultiMap<VirtualFile, TextFilePatchInProgress> patchGroups, VirtualFile baseDir)
  throws IOException {
  final List<FilePatch> textPatches = new ArrayList<FilePatch>();
  final String baseDirPath = baseDir.getPath();

  for (Map.Entry<VirtualFile, Collection<TextFilePatchInProgress>> entry : patchGroups.entrySet()) {
    final VirtualFile vf = entry.getKey();
    final String currBasePath = vf.getPath();
    final String relativePath = VfsUtilCore.getRelativePath(vf, baseDir, '/');
    final boolean toConvert = !StringUtil.isEmptyOrSpaces(relativePath) && !".".equals(relativePath);
    for (TextFilePatchInProgress patchInProgress : entry.getValue()) {
      final TextFilePatch patch = patchInProgress.getPatch();
      if (toConvert) {
        //correct paths
        patch.setBeforeName(convertRelativePath(patch.getBeforeName(), currBasePath, baseDirPath));
        patch.setAfterName(convertRelativePath(patch.getAfterName(), currBasePath, baseDirPath));
      }
      textPatches.add(patch);
    }
  }
  return textPatches;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ApplyPatchSaveToFileExecutor.java

示例12: getSourceRoots

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public VirtualFile[] getSourceRoots(Module module, ProtoPsiFileRoot psiFileRoot) {
    try {
        if (GET_INSTANCE != null && GET_RESOURCE_ROOTS != null) {
            Object configurationInstance = GET_INSTANCE.invoke(null, module.getProject());
            if (configurationInstance != null) {
                List<VirtualFile> result = new ArrayList<>();
                MultiMap<String, String> resourceRoots = (MultiMap<String, String>) GET_RESOURCE_ROOTS.invoke(configurationInstance);
                for (Map.Entry<String, Collection<String>> entry : resourceRoots.entrySet()) {
                    for (String uri : entry.getValue()) {
                        if (!Strings.isNullOrEmpty(uri) && uri.startsWith("file://")) {
                            String path = uri.substring(7);
                            VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path);
                            if (file != null && file.isDirectory()) {
                                result.add(file);
                            }
                        }
                    }
                }
                return result.toArray(new VirtualFile[0]);
            }
        }
    } catch (Exception e) {
        LOGGER.warn("Could not get source roots for WebCore IDE", e);
    }
    return new VirtualFile[0];
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:29,代码来源:WebCoreResourcePathRootsProvider.java

示例13: convertToSingleElementMap

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Nullable
private Map<Repo, VcsFullCommitDetails> convertToSingleElementMap(@NotNull MultiMap<Repo, VcsFullCommitDetails> groupedCommits) {
  Map<Repo, VcsFullCommitDetails> map = ContainerUtil.newHashMap();
  for (Map.Entry<Repo, Collection<VcsFullCommitDetails>> entry : groupedCommits.entrySet()) {
    Collection<VcsFullCommitDetails> commits = entry.getValue();
    if (commits.size() != 1) {
      return null;
    }
    map.put(entry.getKey(), commits.iterator().next());
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:VcsLogOneCommitPerRepoAction.java

示例14: buildTree

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public Set<PsiFile> buildTree(DefaultMutableTreeNode root, ConfigFileSearcher... searchers) {
  final Set<PsiFile> psiFiles = new com.intellij.util.containers.HashSet<PsiFile>();

  final MultiMap<Module, PsiFile> files = new MultiMap<Module, PsiFile>();
  final MultiMap<VirtualFile, PsiFile> jars = new MultiMap<VirtualFile, PsiFile>();
  final MultiMap<VirtualFile, PsiFile> virtualFiles = new MultiMap<VirtualFile, PsiFile>();

  for (ConfigFileSearcher searcher : searchers) {
    files.putAllValues(searcher.getFilesByModules());
    jars.putAllValues(searcher.getJars());
    virtualFiles.putAllValues(searcher.getVirtualFiles());
  }

  psiFiles.addAll(buildModuleNodes(files, jars, root));

  for (Map.Entry<VirtualFile, Collection<PsiFile>> entry : virtualFiles.entrySet()) {
    DefaultMutableTreeNode node = createFileNode(entry.getKey());
    List<PsiFile> list = new ArrayList<PsiFile>(entry.getValue());
    Collections.sort(list, FILE_COMPARATOR);
    for (PsiFile file : list) {
      node.add(createFileNode(file));
    }
    root.add(node);
  }

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

示例15: hasNonEmptyGroups

import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private boolean hasNonEmptyGroups(MultiMap<FileType, PsiFile> filesByType) {
  byte nonEmptyGroups = 0;
  for (Map.Entry<FileType, Collection<PsiFile>> entry : filesByType.entrySet()) {
    Collection<PsiFile> files = entry.getValue();
    if (files != null && files.size() > 0) nonEmptyGroups++;
  }
  return nonEmptyGroups > 1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ConfigFilesTreeBuilder.java


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