Java n-way tree, for general purpose. Functional approach.