Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,499 Points

Someone answer this question, i was thinking the same thing

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 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.