code: @Override
      public boolean hasNext() {
          resetToLastKey();
  
          // Fail if there is no node anymore.
          if (mNextKey == NULL_NODE) {
              resetToStartKey();
              return false;
          }
  
          moveTo(mNextKey);
  
          // Fail if the subtree is finished.
          if (((ITreeStructData)getNode()).getLeftSiblingKey() == getStartKey()) {
              resetToStartKey();
              return false;
          }
  
          // Always follow first child if there is one.
          if (((ITreeStructData)getNode()).hasFirstChild()) {
              mNextKey = ((ITreeStructData)getNode()).getFirstChildKey();
              if (((ITreeStructData)getNode()).hasRightSibling()) {
                  mRightSiblingKeyStack.push(((ITreeStructData)getNode()).getRightSiblingKey());
              }
              return true;
          }
  
          // Then follow right sibling if there is one.
          if (((ITreeStructData)getNode()).hasRightSibling()) {
              mNextKey = ((ITreeStructData)getNode()).getRightSiblingKey();
              return true;
          }
  
          // Then follow right sibling on stack.
          if (mRightSiblingKeyStack.size() > 0) {
              mNextKey = mRightSiblingKeyStack.pop();
              return true;
          }
  
          // Then end.
          mNextKey = NULL_NODE;
          return true;
      }
docs: {@inheritDoc}