Is anyone aware of a generic tree (nodes may have multiple children) implementation for Java? It should come from a well trusted source and must be fully tested.
Guava 15.0 introduces a nice API for tree traversal so you don't need to re-implement it for the gazillionth time in your codebase.
Namely, TreeTraverser and some specialized implementations, like BinaryTreeTraverser.
A very much welcome addition to avoid re-implementing something so simple and with added bonus:
Notice that Guava also provides now new methods to its Files
utility class that make use of the TreeTraverser
, e.g. Files.fileTreeTraverser() which gives you a TreeTraverser
for your file-system traversal needs.