Part of the project I'm working on got updated, and at some point somebody started sending empty collections instead of null as parameters to a method.
This led to a single bug first, which then led me to change if (null == myCollection)
with if (CollectionUtils.isEmpty(myCollection))
, which in the end led to a cascade of several bugs. This way I discovered that a lot of the code was treating differently these two situations:
- when a collection is empty (ie. the user specifically wanted to have nothing here)
- when a collection is null (ie. the user did not mention anything here)
Hence, my question: is this good or bad design practice ?
Thank you.
Aucun commentaire:
Enregistrer un commentaire