Return zero length collections or arrays as opposed to returning null

Returning null instead of zero
length collection (use Collections.EMPTY_SET, Collections.EMPTY_LIST, Collections.EMPTY_MAP) is more
error prone, since the programmer writing the calling method might forget to handle a return value of null.

你可能感兴趣的:(Collections)