Can someone explain the getAncestors method? (Tree class)

I vaguely have wrapped my head around recursion enough to understand the previous exercises, however this one seems to escape me. For example, why does this function return a bool instead of just populating a list?