简体   繁体   中英

Add a Custom Tree Class in Java Language Hierarchy

I have designed a CustomTree class and programmed its operations. Nodes are added such that a subtree will become full, before an element can be added to its sibling subtree.

Since Tree is a collection of nodes, I realized that, my CustomTree should implement a Collection Interface.

Is this correct or should my CustomTree extend a more relevant class like TreeSet?

I want to know where my class should go into if it should match Java's language heirarchy.

The question is which properties do you want your class to have? Collection properties (just a general "bag"), Set properties (no two elements are the same) and/or List properties (sequence of elements is relevant)?

Once you have answered these questions for yourself, you can select the proper base class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM