JavaAntiPatterns

Collection of bad coding practices

Posts Tagged ‘array

Null returned from a method returning a collection or an array

with 6 comments

Null should never be returned from a method returning a collection or an array. Instead return a empty array (a static final empty array) or one of the empty collections (e.g. Collections.EMPTY_LIST assuming the client should not be modifying the collection).

(submitted by Rand McNeely)

Written by Alex

November 11, 2009 at 5:10 pm

Posted in Collections

Tagged with , ,