Java parent branches removal