Java Java Data Structures Efficiency! Building the Model

don't repeat yourself concept in this video?

**In the video, Craig created a Class named SongBook. In the class it had a private variable list of Song named mSongs and a constructor :

private List<Song> mSongs;

public SongBook() { mSongs = new ArrayList<Song>(); }

**Was it really necessary to create the constructor in this situation? Why didn't he keep it simple and did this instead:

private List<song> mSongs = new ArrayList<Song>();

Luis Flores
Luis Flores
10,490 Points

Someone answer this question, i was thinking the same thing

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,860 Points

I'm not sure why Craig did that. It's been a while since I used Java, so there might be a reason I am completely unaware of.