• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which Java 8 feature do you like the most?

 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 284
35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 284
35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2236
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 284
35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic