A generic Tree structure made in Delphi is freely available at this GitHub repository:
https://github.com/davidberneda/GenericTree
See the readme at GitHub for details and updated documentation.
This small class allows creating hierarchical structures where each “node” is a small object (20 bytes plus your own data size), containing a property of your desired type.
For example, a Tree of string nodes:
var MyTree : TNode<String>;
MyTree.Data :='hello';
Great work! Delphi needs comp.sci.algorithm and data structure implementations like this to continue its long standing use since the days of Borland. Great to see the strides Embarcadero has made with regard to multi-platform support and coders like yourself expanding the library of shared resources and code. Thank you for saving me the time of coding this and writing this by sharing it. I will follow your example and share code of mine on github to help other Delphi coders build extensive libraries.
Yours truly a somewhat controversial personality,
Brian Joseph Johns
Shhhhh! Digital Media
Thanks for your Generic Tree. I’ve made some useful additions. “GetNext” is particularly useful for iterating the tree.