Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Threads and Services But Wait There's More! Foreground Services

Is there any reason to create the notificationBuilder variable in this video?

In the video the notification was created with with this code:

Notification.Builder notificationBuilder = new Notification.Builder(this);
notificationBuilder.setSmallIcon(R.mipmap.ic_launcher);
Notification notification = notificationBuilder.build();

But as far as i know creating the builder variable is not necessary, and the same thing can be done like this:

Notification notification = new Notification.Builder(this)
    .setSmallIcon(R.mipmap.ic_launcher)
    .build();

Is there any reason (style / performance ) to write out the longer version?

edit: It seems the longer version was only used for educational purposes - the same project is used in the next course ( Intents and Receivers ) and the code will be rewritten to the shorter version to take advantage of the "fluent interface".

I'll leave the question up though, in case i was wrong.