Java Code Examples for com.intellij.util.containers.ContainerUtil#concatIterators()

The following examples show how to use com.intellij.util.containers.ContainerUtil#concatIterators() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MergeList.java    From consulo with Apache License 2.0 4 votes vote down vote up
public Iterator<Change> getAllChanges() {
  return ContainerUtil.concatIterators(myBaseToLeftChangeList.getChanges().iterator(), myBaseToRightChangeList.getChanges().iterator());
}
 
Example 2
Source File: VcsDirtyScopeImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public VcsDirtyScopeImpl(final AbstractVcs vcs, final Project project) {
  myProject = project;
  myVcs = vcs;
  myVcsManager = ProjectLevelVcsManager.getInstance(project);
  myWasEverythingDirty = false;
  myVcsDirtyScopeModifier = new VcsDirtyScopeModifier() {
    @Override
    public Collection<VirtualFile> getAffectedVcsRoots() {
      return Collections.unmodifiableCollection(myDirtyDirectoriesRecursively.keySet());
    }

    @Override
    public Iterator<FilePath> getDirtyFilesIterator() {
      if (myDirtyFiles.isEmpty()) {
        return Collections.<FilePath>emptyList().iterator();
      }
      final ArrayList<Iterator<FilePath>> iteratorList = new ArrayList<>(myDirtyFiles.size());
      for (THashSet<FilePath> paths : myDirtyFiles.values()) {
        iteratorList.add(paths.iterator());
      }
      return ContainerUtil.concatIterators(iteratorList);
    }

    @Nonnull
    @Override
    public Iterator<FilePath> getDirtyDirectoriesIterator(final VirtualFile root) {
      final THashSet<FilePath> filePaths = myDirtyDirectoriesRecursively.get(root);
      if (filePaths != null) {
        return filePaths.iterator();
      }
      return ContainerUtil.emptyIterator();
    }

    @Override
    public void recheckDirtyKeys() {
      recheckMap(myDirtyDirectoriesRecursively);
      recheckMap(myDirtyFiles);
    }

    private void recheckMap(Map<VirtualFile, THashSet<FilePath>> map) {
      for (Iterator<THashSet<FilePath>> iterator = map.values().iterator(); iterator.hasNext(); ) {
        final THashSet<FilePath> next = iterator.next();
        if (next.isEmpty()) {
          iterator.remove();
        }
      }
    }
  };
}
 
Example 3
Source File: GenericPatchApplier.java    From consulo with Apache License 2.0 4 votes vote down vote up
private Iterator<Integer> getMatchingIterator(final String line, final int originalStart, final int maxWalkFromBinding) {
  return ContainerUtil.concatIterators(new WalkingIterator(line, originalStart, maxWalkFromBinding, true),
                                       new WalkingIterator(line, originalStart, maxWalkFromBinding, false));
}