I have defined a subclass of DefaultMutableTreeNode Class in java :

public AccountsTreeNode extends DefaultMutableTreeNode {


in this class I have a recursive method called getsorted(ArrayList list_) , which accummulated the list_.

In this method, I have to call this.children() which returns the children of the node, but the children
are all of type "DefaultMutableTreeNode". I have to call the method getsorted on these children,
but since the getsorted is a mehtod of AccontsTreeNode, it gives me runtime cast error.

What is the best solution to these problem? Should I convert children to AccountTreeNode type by
overriding the children() method?