Obviously one of the greatest banes of Java programming is nulls and null-pointer exception. What design patterns are there that don’t add too much to your code but reduce the problem of sand null-pointer exceptions?
Advertisement
Answer
Null Object pattern. Look at Optional class from google-guava library.
Their wiki has an article on using and avoiding nulls.