-2

I have a question about the object X.equals(Y).

I use Sonar and it says that I have to move the "" string literal on the left side of this string comparison: !date.equals("").

So I did that: !("").equals(date) but I don't really know if it is right or not.

Tulains Córdova
  • 39,570
  • 13
  • 100
  • 156
Fosfor
  • 19

1 Answers1

1

!"".equals(date) and !("").equals(date) and !(("")).equals(date) and !(((""))).equals(date) and !("".equals(date)) all return the same thing.

So you correctly switched the string literal with the variable, you just added some not needed parentheses.

Darsstar
  • 266