Initialize fileds in DTO

Viewed 3441

A friend of me advices me to initialise DTO fields of type (ArrayList) and only of type ArrayList in DTOs like this to avoid NullPointerException

public class fooDto {
    private SomeClasse someClasse = new SomeClasse();
    private ArrayList<Bar> bars = new ArrayList();
}

should we do his ? and is it a good practice

in other way , should we use "= new SomeClasse()" or not ?

3 Answers
Related