Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Modern Java in Action: Java 7 to 8

 
Greenhorn
Posts: 28
1
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As someone that will soon pitch an enterprise level client on switching from 1.7 to (at least) 1.8, what are the biggest benefits of Lambdas and Streams (or any others if you care to discuss them)?

Also, in your opinion(s), what is the learning curve for really understanding what and how to use these new features?
 
Marshal
Posts: 69382
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a declarative style of programming.
You can have ready‑made methods/objects to create Lists, arrays, Sets, Maps, Comparators, etc.
You can simplify threading by simply turning a Stream parallel.
But if your code ain't broke, don't fix it.
You should probably move off Java7, which is rapidly approaching the end of its supported lifetime. Even Java8 is 4¾ years old.
 
Sheriff
Posts: 21941
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And just about end-of-life itself, since the release of Java 11 in September.
 
Ranch Hand
Posts: 102
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code written in Java is generally considered as boilerplate, that is so true with all the previous versions holds good on Java 7 as well, not anymore...
Java8 alleviate some of these issues by moving to more functional style for the new APIs, thus your code looks a lot simpler and elegant it focuses on
what you want to do and not how to do it.
 
Campbell Ritchie
Marshal
Posts: 69382
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are conflating boilerplate code and imperative code. It is much easier to write Java8 code so you can understand its intent by reading it, which is a declarative style. It is also possible to iterate the whole of a data structure with  a loop, but a Stream will require less boilerplate code.
Of course, in many cases it is possible two kill two birds with the same stone.
 
What does a metric clock look like? I bet it is nothing like this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic