I\'ve written an n-ary tree ADT which works fine. However, I need to store its serialization in a variable a calling class. eg.
DomTree a
If a profiler confirms you that the bottleneck is string concatenation you have two choices:
A rope is a high performance replacement for Strings. The datastructure, described in detail in "Ropes: an Alternative to Strings", provides asymptotically better performance than both String and StringBuffer for common string modifications like prepend, append, delete, and insert. Like Strings, ropes are immutable and therefore well-suited for use in multi-threaded programming.