Created
August 18, 2008 15:04
-
-
Save claymccoy/5975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TreeNode { | |
private final String name; | |
private final Collection<TreeNode> children; | |
public TreeNode(String name) { | |
this.name = name; | |
children = new HashSet<TreeNode>(); | |
} | |
public String getName() { | |
return this.name; | |
} | |
public Collection<TreeNode> getChildren() { | |
// don't show your privates! | |
return Collections.unmodifiableCollection(children); | |
} | |
public void addChild(final TreeNode treeNode) { | |
children.add(treeNode); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment