Il titolo praticamente dice tutto. Di solito sto testando questo insieme a a string == null, quindi non sono davvero preoccupato per un test nullo. Quale dovrei usare?
String s = /* whatever */;
...
if (s == null || "".equals(s))
{
// handle some edge case here
}
o
if (s == null || s.isEmpty())
{
// handle some edge case here
}
In quella nota - fa isEmpty()anche qualcosa di diverso da return this.equals("");o return this.length() == 0;?
isEmpty()è solo Java 6+.