Use isEmpty() instead of "".equals() on strings. #1555
Fixes `StringEqualsEmptyString` inspection violations. Description: >Reports .equals() being called to compare a String with an empty string. It is normally more performant to test a String for emptiness by comparing its .length() to zero instead.
This commit is contained in:
parent
d8bacb1e5d
commit
85d6fcba9c
|
|
@ -269,7 +269,7 @@ public final class FileContents implements CommentListener {
|
|||
**/
|
||||
public boolean lineIsBlank(int lineNo) {
|
||||
// possible improvement: avoid garbage creation in trim()
|
||||
return "".equals(line(lineNo).trim());
|
||||
return line(lineNo).trim().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue