There are benefits to each, and I understand the differences - but what is considered best / standard practice? Why?
"myString".equals(myStringVar)
- Avoids a potential NPE and does not require a null check. (Good thing?)
- Cleaner to read since a null check is not required.
- If null is not an expected value, your program could be breaking without being any the wiser.
myStringVar.equals("myString")
- Requires a null check if null is an expected value. (Good thing?)
- Can clutter up compound conditionals with null checks.
- Allows for NPE to let us know if something has broken.