I wanna prevent getters from returning null values, like the examples bellow. Is this a bad practice?
Example 1
public Integer getMinutes() {
if (minutes == null)
minutes = 0;
return minutes;
}
Example 2
public List getTasks() {
if (tasks == null)
tasks = new ArrayList();
return tasks;
}
Aucun commentaire:
Enregistrer un commentaire