File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
library/src/main/java/com/unnamed/b/atv/model Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public class TreeNode {
2020 public static final String NODES_ID_SEPARATOR = ":" ;
2121
2222 private int mId ;
23+ private int mLastId ;
2324 private TreeNode mParent ;
2425 private boolean mSelected ;
2526 private boolean mSelectable = true ;
@@ -36,15 +37,18 @@ public static TreeNode root() {
3637 return root ;
3738 }
3839
40+ private int generateId () {
41+ return ++mLastId ;
42+ }
43+
3944 public TreeNode (Object value ) {
4045 children = new ArrayList <>();
4146 mValue = value ;
4247 }
4348
4449 public TreeNode addChild (TreeNode childNode ) {
4550 childNode .mParent = this ;
46- //TODO think about id generation
47- childNode .mId = size ();
51+ childNode .mId = generateId ();
4852 children .add (childNode );
4953 return this ;
5054 }
You can’t perform that action at this time.
0 commit comments