}
@Override
public void update(ExpandedState expandedState) {
this.expandedState = expandedState;
TreeNode current = data;
int counter = back.size();
while (current != null) {
if (!back.containsKey(current)) {
mapping.put(counter, new Data(current));
back.put(current, counter);
counter++;
}
// if the node has children and is expanded, go to the children
if (current.getChildCount() > 0 && expandedState.isExpanded(current)) {
current = current.getChildAt(0);
} else {
current = getNextNodeButNoChild(current);
}
}
}