...
Note that the null check is redundant; if it were removed, the subsequent call to s.equals("")
would throw a NullPointerException
when s
is null. However, the null check explicitly indicates the programmer's intent. More complex code may require explicit testing of invariants and appropriate throw statements.
...
Bibliography
...