- Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathTreeNode.java
More file actions
Latest commit
executable file
·33 lines (24 loc) · 634 Bytes
/
Copy pathTreeNode.java
File metadata and controls
executable file
·33 lines (24 loc) · 634 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
packagetutorialquestions.question96df.original;
publicclassTreeNode<E> {
privateEkey;
privatefinalTreeNode<E>[] children;
@SuppressWarnings("unchecked")
publicTreeNode(intnumberOfChildren) {
children = (TreeNode<E>[]) newTreeNode[numberOfChildren];
}
publicintgetNumberOfChildren() {
returnchildren.length;
}
publicTreeNode<E> getChild(intchildIndex) {
returnchildren[childIndex];
}
publicvoidsetChild(intchildIndex, TreeNode<E> child) {
children[childIndex] = child;
}
publicEgetKey() {
returnkey;
}
publicvoidsetKey(Ekey) {
this.key = key;
}
}