Prior art

There is a TreeSet and a TreeMap class in the standard Java library. This does not expose a tree API just a set and map. The tree is just an implementation detail. This feels like the correct approach for a Collection API.

There is a tree API that extends the Collection API by implementing the Iterable and Serializable interfaces. The Iterable interface is not suitable as it does not specify the order of the iteration. It has additional methods for returning ordered collections, from the implementations these are not evaluated lazily. All tree implementations need to provide these separately duplicating work. The API assumes that the trees will be mutable. This is like the Collection implementation that to expose an unmodifiable implementation does so using a mutable API that throws an UnsupportedOperationException when invoking mutation operations. Characteristics should be enforced by the API not by the runtime behavior. This API is intended for extension will a clean separation between the API and the provided implementations.

There is an implementation of the DOM Document API that provides a use case specific tree implementation. The Document tree has multiple types of nodes (elements, attributes and character data etc.). During navigation these are returned in a custom NodeList that provides an immutable list that is not based on the Collections API. This list exposes nodes, not the different types of nodes so it is necessary to check the type of each node returned.

The Stanford JavaNLP API provides a tree API. These trees extend the Collection interface, providing implementations only for non-mutating methods. The tree is mutable using the methods defined in the Tree class. The Tree implementation contains convenience methods for many things like deep coping and deciding if one tree dominates another. Placing these methods within the tree implementation makes it hard to extend.

There are other tree implementations provided as a part of other libraries. The Prefuse visualisation toolkit, the Apache POI for Open and Microsoft office documents, the Zkoss framework. There are many tree implementations that have been created for specific use cases.