Small Tips

Don’t catch NullPointerException. Check for it.

String concatenation to create a hash key or to store multiple values is easy but fragile. Prefer an object key with a proper hashcode. Prefer an object to store multiple values. Otherwise use a standard such as CSV instead of using your own “dash-separated values”. Use a library to handle escaping problems (a name may also contain a comma).

If you do need to concat Strings, use StringBuilder/StringBuffer. Know the difference between the two.

Leave a Reply

Your email address will not be published. Required fields are marked *