There are benefits to each and I understand the differences, but what is considered best / standard practice? And why?For example :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.However 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.Which variation is considered the standard to use for Java, and why?
When comparing a string variable to a string literal with .equals(), is there a standard practice for the order of items?
java;programming practices;coding standards