TreeIterator.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:bazel-buildfarm 作者:
@Override
public Directory next() throws NoSuchElementException {
  Iterator<Digest> iter = pointers.peek();
  if (!iter.hasNext()) {
    throw new NoSuchElementException();
  }
  /* we can have null directories in our list
   * if members of the tree have been removed from
   * the cas.  we return this to retain the information
   * (and simplify the interface) that they have been
   * removed. */
  Digest digest = iter.next();
  Directory directory = expectDirectory(instance.getBlob(digest));
  if (directory != null) {
    /* the path to a new iter set is the path to its parent */
    parentPath.addLast(digest);
    path = parentPath.clone();
    pointers.push(Iterators.transform(
        directory.getDirectoriesList().iterator(),
        directoryNode -> directoryNode.getDigest()));
  }
  advanceIterator();
  return directory;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号