When I have a potential null input... is it better to always check for it:
public void doSomething(String str) { if (str == null) throw new NullPointerException(); processData(str); } or pass on the invalid data, and wait for "processData()" to throw the nullPointerException:
public void doSomething(String str) { processData(str); }
Optional<String>for possibly missing values. So a javadoc comment would be entirely sufficient.