當前位置: 首頁>>代碼示例>>Java>>正文


Java ContainerUtil.emptyIterator方法代碼示例

本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.emptyIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.emptyIterator方法的具體用法?Java ContainerUtil.emptyIterator怎麽用?Java ContainerUtil.emptyIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.containers.ContainerUtil的用法示例。


在下文中一共展示了ContainerUtil.emptyIterator方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: children

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
@Override
public JBIterable<? extends T> children(@NotNull final T node) {
  return new JBIterable<T>() {
    @Override
    public Iterator<T> iterator() {
      FlyweightCapableTreeStructure<T> structure = getStructure();
      Ref<T[]> ref = Ref.create();
      int count = structure.getChildren(structure.prepareForGetChildren(node), ref);
      if (count == 0) return ContainerUtil.emptyIterator();
      T[] array = ref.get();
      LinkedList<T> list = ContainerUtil.newLinkedList();
      for (int i = 0; i < count; i++) {
        T child = array[i];
        IElementType childType = typeOf(child);
        // skip TokenType.* types, errors cannot be properly handled (no parents)
        if (childType == TokenType.ERROR_ELEMENT) {
          // todo remember error
          continue;
        }
        else if (childType == TokenType.WHITE_SPACE || childType == TokenType.BAD_CHARACTER) {
          continue;
        }
        array[i] = null; // do not dispose meaningful TokenNodes
        list.addLast(child);
      }
      structure.disposeChildren(array, count);
      return list.iterator();
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:SyntaxTraverser.java

示例2: VcsDirtyScopeImpl

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
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<Iterator<FilePath>>(myDirtyFiles.size());
      for (THashSet<FilePath> paths : myDirtyFiles.values()) {
        iteratorList.add(paths.iterator());
      }
      return ContainerUtil.concatIterators(iteratorList);
    }

    @NotNull
    @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();
        }
      }
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:50,代碼來源:VcsDirtyScopeImpl.java


注:本文中的com.intellij.util.containers.ContainerUtil.emptyIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。