code: public Account findNearestRelative(Account account) {
          // If it's root, there are no siblings
          if (account.isRoot())
              return null;
  
          // If it has no parent, it's not in this tree
          Account parent = findParent(account);
          if (parent == null)
              return null;
  
          // It's an only child, return the parent
          if (parent.getChildren().size() == 1)
              return parent;
  
          // If it doesn't have an index, it's also not in this tree (should not be possible, assume parent)
          int index = parent.getChildren().indexOf(account);
          if (index == -1)
              return parent;
  
          // If it's the last node, use the previous node
          if (index == parent.getChildren().size() - 1)
              return parent.getChildren().get(index - 1);
  
          // Otherwise use the next node
          return parent.getChildren().get(index + 1);
      }
docs: Finds the nearest relative of this node.
  <p>
  The nearest relative is either the next sibling, previous sibling, or parent in the case
  where it is an only child.  If it is not found to be a member of this tree, null is returned.
  If you pass in the root node, null is returned.
  
  @param account The account to find the nearest relative of.
  @return See description.