Hacker News new | ask | show | jobs
by wh0knows 789 days ago
Inputs to standard libraries will obviously never NPE if you pass in a non-null value. For outputs, a lot of standard collection .get() calls are unnecessary when you’re working with small collections or Optionals, where you simply use stream, filter, ifPresent.

Or simply wrap the return with Optional.ofNullable, checkstyle will not accept it if you don’t.