类com.google.common.collect.TreeTraverser源码实例Demo

下面列出了怎么用com.google.common.collect.TreeTraverser的API类实例代码及写法,或者点击链接到github查看源代码。

private Stream<DocumentSymbol> asStream(Collection<? extends DocumentSymbol> symbols) {
	//@formatter:off
	return symbols.stream()
			.map(s -> TreeTraverser.<DocumentSymbol>using(ds -> ds.getChildren() == null
				? Collections.<DocumentSymbol>emptyList()
				: ds.getChildren()).breadthFirstTraversal(s).toList())
			.flatMap(List::stream);
	//@formatter:on
}
 
源代码2 项目: dex-method-counts   文件: DexMethodCounts.java
private static <T> TreeTraverser<T> treeTraverserOf(Function<T, Iterable<T>> childrenFunction) {
  return new TreeTraverser<T>() {
    @Override
    public Iterable<T> children(T root) {
      return childrenFunction.apply(root);
    }
  };
}
 
源代码3 项目: mapper   文件: Composites.java
public static <CompositeT extends Composite<CompositeT>> Iterable<CompositeT> preOrderTraversal(CompositeT root) {
  return TreeTraverser.using(new com.google.common.base.Function<CompositeT, Iterable<CompositeT>>() {
    @Override
    public Iterable<CompositeT> apply(CompositeT input) {
      return input == null ? Collections.<CompositeT>emptyList() : input.children();
    }
  }).preOrderTraversal(root);
}
 
源代码4 项目: rainbow   文件: AstUtils.java
public static Stream<Node> preOrder(Node node)
{
    return TreeTraverser.using((Node n) -> unmodifiableIterable(n.getChildren()))
            .preOrderTraversal(requireNonNull(node, "node is null"))
            .stream();
}
 
源代码5 项目: vjtools   文件: FileTreeWalker.java
/**
 * 直接使用Guava的TreeTraverser,获得更大的灵活度, 比如加入各类filter,前序/后序的选择,一边遍历一边操作
 * 
 * <pre>
 * FileUtil.fileTreeTraverser().preOrderTraversal(root).iterator();
 * </pre>
 */
public static TreeTraverser<File> fileTreeTraverser() {
	return Files.fileTreeTraverser();
}
 
源代码6 项目: vjtools   文件: FileTreeWalker.java
/**
 * 直接使用Guava的TreeTraverser,获得更大的灵活度, 比如加入各类filter,前序/后序的选择,一边遍历一边操作
 * 
 * <pre>
 * FileUtil.fileTreeTraverser().preOrderTraversal(root).iterator();
 * </pre>
 */
public static TreeTraverser<File> fileTreeTraverser() {
	return Files.fileTreeTraverser();
}
 
源代码7 项目: j360-dubbo-app-all   文件: FileTreeWalker.java
/**
 * 直接使用Guava的TreeTraverser,获得更大的灵活度, 比如加入各类filter,前序/后序的选择,一边遍历一边操作
 * 
 * <pre>
 * FileUtil.fileTreeTraverser().preOrderTraversal(root).iterator();
 * </pre>
 */
public static TreeTraverser<File> fileTreeTraverser() {
	return Files.fileTreeTraverser();
}
 
源代码8 项目: codebuff   文件: Files.java
/**
 * Returns a {@link TreeTraverser} instance for {@link File} trees.
 *
 * <p><b>Warning:</b> {@code File} provides no support for symbolic links, and as such there is no
 * way to ensure that a symbolic link to a directory is not followed when traversing the tree. In
 * this case, iterables created by this traverser could contain files that are outside of the
 * given directory or even be infinite if there is a symbolic link loop.
 *
 * @since 15.0
 */
public static TreeTraverser<File> fileTreeTraverser() {
  return FILE_TREE_TRAVERSER;
}
 
源代码9 项目: codebuff   文件: Files.java
/**
 * Returns a {@link TreeTraverser} instance for {@link File} trees.
 *
 * <p><b>Warning:</b> {@code File} provides no support for symbolic links, and as such there is no
 * way to ensure that a symbolic link to a directory is not followed when traversing the tree. In
 * this case, iterables created by this traverser could contain files that are outside of the
 * given directory or even be infinite if there is a symbolic link loop.
 *
 * @since 15.0
 */


public static TreeTraverser<File> fileTreeTraverser() {
  return FILE_TREE_TRAVERSER;
}
 
源代码10 项目: codebuff   文件: Files.java
/**
 * Returns a {@link TreeTraverser} instance for {@link File} trees.
 *
 * <p><b>Warning:</b> {@code File} provides no support for symbolic links, and as such there is no
 * way to ensure that a symbolic link to a directory is not followed when traversing the tree. In
 * this case, iterables created by this traverser could contain files that are outside of the
 * given directory or even be infinite if there is a symbolic link loop.
 *
 * @since 15.0
 */


public static TreeTraverser<File> fileTreeTraverser() {
  return FILE_TREE_TRAVERSER;
}
 
源代码11 项目: codebuff   文件: Files.java
/**
 * Returns a {@link TreeTraverser} instance for {@link File} trees.
 *
 * <p><b>Warning:</b> {@code File} provides no support for symbolic links, and as such there is no
 * way to ensure that a symbolic link to a directory is not followed when traversing the tree. In
 * this case, iterables created by this traverser could contain files that are outside of the
 * given directory or even be infinite if there is a symbolic link loop.
 *
 * @since 15.0
 */


public static TreeTraverser<File> fileTreeTraverser() {
  return FILE_TREE_TRAVERSER;
}
 
源代码12 项目: codebuff   文件: Files.java
/**
 * Returns a {@link TreeTraverser} instance for {@link File} trees.
 *
 * <p><b>Warning:</b> {@code File} provides no support for symbolic links, and as such there is no
 * way to ensure that a symbolic link to a directory is not followed when traversing the tree. In
 * this case, iterables created by this traverser could contain files that are outside of the
 * given directory or even be infinite if there is a symbolic link loop.
 *
 * @since 15.0
 */


public static TreeTraverser<File> fileTreeTraverser() {
  return FILE_TREE_TRAVERSER;
}
 
 同包方法