Negative Latency

... when you try to be pr0, but fail to succeed

Comparing Strings

Posted by googie On Sunday, July 04, 2010 0 komentarze Categories: , , ,

Nothing much, really, but I recently noticed that when you need to compare two Strings in Java, when one of them is constant, instead of

stringVariable != null && stringVariable.equals("someConstantString")

you can simply do

"someConstantString".equals(stringVariable)

, which does all the magic at once.

0 Response for the "Comparing Strings"

Post a Comment