Showing posts with label code-snippets. Show all posts
Showing posts with label code-snippets. Show all posts

Wednesday, May 23, 2012

How to avoid "!= null' statements in Java?


I work with Java all day long. The most used idiom (code snippet) I'm programming in Java, is to test if an object != null before I use it, to avoid a NullPointerException of course. But the code looks very ugly and becomes unreadable.