Are you suggesting to group the two isEmpty() condition?