I'd have said `Objects.equal(contender.getParent(), ancestor)` here, to make it a proper descendant check.