• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which Java 8 feature do you like the most?  RSS feed

 
Palak Mathur
Ranch Hand
Posts: 342
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cay,

Welcome to the ranch! I have read older versions of your books and loved them. The way you teach Java is very lucid and comprehensive.

Over the years you have written books for Java and have experienced all version of Java. What do you think are the best features of Java 8 that you think are covered by you in Volume 1 of your book? I understand that Vol 2 covers streams, etc.
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Palak, that's a really easy question. For me, the best part of Java 8 is lambda expressions.

Every time that I can use one instead of an anonymous instance of an anonymous class, I smile. Conversely, when I do Android programming with inner classes for callbacks, I sigh.

Cheers,

Cay
 
Junilu Lacar
Sheriff
Posts: 10880
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really like method references and how they can often be very frontmen/stand-ins for lambda expressions.
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Absolutely. Method references are great. Whenever you find yourself writing something like (Person x) -> x.getId(), recognize the pattern and rewrite it as Person::getId.
 
Paweł Baczyński
Bartender
Posts: 1998
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cay Horstmann wrote:Whenever you find yourself writing something like (Person x) -> x.getId(), recognize the pattern and rewrite it as Person::getId.


Those can be easily converted using a decent IDE.
Also, my favorites are lambdas and streams API.
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point about the IDE.

I just started using Android Studio, which turns anonymous instances of anonymous classes into what looks like lambda expressions. At first, it was nice, but it bothered me that it was only skin deep. It is always best to have the feature in the language.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!