Design Pattern, Java, OO Design Principles

Avoid NullPointerException in Java

I would like to share with you some tips to deal/prevent NPE in your code: The BIG IMPORTANT rule: do NOT assign / pass / return null value and keep your code as cohesive as possible. Programming tips / techniques: 1. Return an empty collections instead of null. For example: List: Set: Map: 2. Return… Continue reading Avoid NullPointerException in Java