本文整理汇总了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();
}
};
}
示例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();
}
}
}
};
}