Avoid APIs from Pre-History
Do not use
StringBuffer and other archaic parts of the JDK.
Java has been around for over 20 years. In order to maintain backwards compatibility, it has hoarded all manner of APIs that no longer make sense to use. Some of them are handily marked with @Deprecated annotation, others are not.
Unfortunately, many are still used in university courses and online examples. New Java programmers may not be aware they have been replaced - a few to watch out for include:
java.util.Stack- use a
java.util.Hashtable- use a
java.util.Enumeration- use an
Each of these replacements (except
Enumeration) differ from the originals by not being synchronized. If you think you need a synchronized collection go away somewhere quiet and think again.