Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
でJTree構成されているDefaultMutableTreeNodes場合、特定のノードとそのすべての先祖からどのようにトラバースして削除しますか?
JTree
DefaultMutableTreeNodes
最も深いレベルから削除し、指定されたノードまで上向きに削除する必要があります。指定された開始ノードは、最後に削除する必要があります。
ここでは再帰があなたの味方です。
擬似コード:
def deleteTree(root) for each child c of root deleteTree(c) end delete root end