Java Jirawat
Jirawat Uttayaya Tech Notes
SyntaxHighlighter JS
2013-01-13
Null safe string equals
Instead of
if ( str != null && str.equals("TheString") )
use
if ( "TheString".equals(str) )
The second form is more concise and will return false if str is null.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment