Java tree, for general purpose. Functional approach.