com.google.common.collect.TreeTraverser Java Examples
The following examples show how to use
com.google.common.collect.TreeTraverser.
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: DocumentSymbolHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
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 }
Example #2
Source File: DexMethodCounts.java From dex-method-counts with Apache License 2.0 | 5 votes |
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); } }; }
Example #3
Source File: Composites.java From mapper with Apache License 2.0 | 5 votes |
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); }
Example #4
Source File: AstUtils.java From rainbow with Apache License 2.0 | 4 votes |
public static Stream<Node> preOrder(Node node) { return TreeTraverser.using((Node n) -> unmodifiableIterable(n.getChildren())) .preOrderTraversal(requireNonNull(node, "node is null")) .stream(); }
Example #5
Source File: FileTreeWalker.java From vjtools with Apache License 2.0 | 2 votes |
/** * 直接使用Guava的TreeTraverser,获得更大的灵活度, 比如加入各类filter,前序/后序的选择,一边遍历一边操作 * * <pre> * FileUtil.fileTreeTraverser().preOrderTraversal(root).iterator(); * </pre> */ public static TreeTraverser<File> fileTreeTraverser() { return Files.fileTreeTraverser(); }
Example #6
Source File: FileTreeWalker.java From vjtools with Apache License 2.0 | 2 votes |
/** * 直接使用Guava的TreeTraverser,获得更大的灵活度, 比如加入各类filter,前序/后序的选择,一边遍历一边操作 * * <pre> * FileUtil.fileTreeTraverser().preOrderTraversal(root).iterator(); * </pre> */ public static TreeTraverser<File> fileTreeTraverser() { return Files.fileTreeTraverser(); }
Example #7
Source File: FileTreeWalker.java From j360-dubbo-app-all with Apache License 2.0 | 2 votes |
/** * 直接使用Guava的TreeTraverser,获得更大的灵活度, 比如加入各类filter,前序/后序的选择,一边遍历一边操作 * * <pre> * FileUtil.fileTreeTraverser().preOrderTraversal(root).iterator(); * </pre> */ public static TreeTraverser<File> fileTreeTraverser() { return Files.fileTreeTraverser(); }
Example #8
Source File: Files.java From codebuff with BSD 2-Clause "Simplified" License | 2 votes |
/** * 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; }
Example #9
Source File: Files.java From codebuff with BSD 2-Clause "Simplified" License | votes |
/** * 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; }
Example #10
Source File: Files.java From codebuff with BSD 2-Clause "Simplified" License | votes |
/** * 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; }
Example #11
Source File: Files.java From codebuff with BSD 2-Clause "Simplified" License | votes |
/** * 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; }
Example #12
Source File: Files.java From codebuff with BSD 2-Clause "Simplified" License | votes |
/** * 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; }