Is it good practice to instantiate collection field on declaration? For example:
class A {
private List<String> list = new ArrayList<>();
public List<String> getList() {
return list;
}
public setList(List<String> list) {
this.list = list;
}
}
The reason why I need it is avoiding of checking for null like this:
if (a.getList() != null)