getDepth method
Returns the depth/level in the hierarchy.
Implementation
int getDepth() {
int depth = 0;
var current = parent;
while (current != null) {
depth++;
current = current.parent;
}
return depth;
}
Returns the depth/level in the hierarchy.
int getDepth() {
int depth = 0;
var current = parent;
while (current != null) {
depth++;
current = current.parent;
}
return depth;
}