Some more minor formatting.
Replaced check if the length is zero with isEmpty().