There are benefits to each and I understand the differences, but what is considered best / standard practice? And why?
For example :
- 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.
- 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?