The main benefit of "".equals(s)
is you don’t need the null check (equals
will check its argument and return false
if it’s null), which you seem to not care about. If you’re not worried about s
being null (or are otherwise checking for it), I would definitely use s.isEmpty()
; it shows exactly what you’re checking, you care whether or not s
is empty, not whether it equals the empty string