commons-math icon indicating copy to clipboard operation
commons-math copied to clipboard

Consider returning a zero length array rather than null.

Open Kui-Liu opened this issue 6 years ago • 1 comments

It is often a better design to return a length zero array rather than a null reference to indicate that there are no results (i.e., an empty list of results). This way, no explicit check for null is needed by clients of the method. On the other hand, using null to indicate "there is no answer to this question" is probably appropriate. http://findbugs.sourceforge.net/bugDescriptions.html#PZLA_PREFER_ZERO_LENGTH_ARRAYS

Kui-Liu avatar Oct 13 '17 22:10 Kui-Liu

Coverage Status

Coverage remained the same at 89.963% when pulling 85a6eccec4822d142a4dec0ba369287e74de5ce4 on BruceKuiLiu:master3 into eafb16c711d5cd79edad5fbb2055252acdb3825e on apache:master.

coveralls avatar Oct 13 '17 22:10 coveralls