• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

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: 66537
251
  • 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: 21824
105
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: 77
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: 66537
251
  • 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.
 
Why fit in when you were born to stand out? - Seuss. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!