Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please list down the new features of Java 8

 
Awais Bajwa
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone please list down the new features of Java 8?
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a page which appears to be a summary: http://openjdk.java.net/projects/jdk8/features
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The table of contents of Java 8 for the Really Impatient lists features concisely:

Table of Contents

Lambda Expressions
The Stream API
Programming with Lambdas
JavaFX
The New Date and Time API
Concurrency Enhancements
The Nashorn JavaScript Engine
Miscellaneous Goodies
Java 7 Features That You May Have Missed
 
Jerin Joseph
Greenhorn
Posts: 2
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi the most important things that most would be probably using will be.

1. Defender Methods - Concrete Methods in the Interface !! (This is really cool) you can actually write implemented methods in an Interface.
2. Stream API
3. Lambda Expressions - You will be using this together with the Stream API if you want to use the multi core features. The syntax will take some time to burn in but its really worth it

I am no expert in these things but I believe some one can explain this in more detail over here.......

 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The big Java 8 feature is of course lambdas with all its ramifications (method references, default and static methods in interfaces, streams). That's about 1/3 of my book.

There is a new date/time API that is very nice--you'll never want to use GregorianCalendar again.

If you care about this, there is a high-quality embeddable JavaScript implementation that interoperates with Java. Just last week, in a project on which I am working, we needed some degree of end-user customizability and were about to design some configuration language. Then we realized we could just let the users specify the customizations in JavaScript.

If you still do rich GUI clients, you will want to know about JavaFX. It comes automatically bundled with Java 8, as Swing is now in "maintenance mode".

There are concurrency enhancements, mostly for advanced users. For example, it is now easy to make threadsafe maps of counters. (This used to be surprisingly painful.)

And of course, there are a bunch of minor changes (easy string joining, a mod method with sane behavior for negative inputs, official support for Base64 encoding, etc.) I searched through the source tree and collected the useful nuggets so you wouldn't have to.

Cheers,

Cay
 
Jerin Joseph
Greenhorn
Posts: 2
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can I use Java FX for client side scripting ??
And can you provide more detail on how to link javascript to java code.
Is it something like the GWT where in compile time the code gets converted to javascript ?
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaFX no longer has its own scripting language. You write the code in Java, but you get the JavaFX components, shapes, etc.

Nashorn is nothing like GWT. It is pure JavaScript, but with extensions to manipulate Java objects. It's meant for end-user programmability, kind of like VBScript in MS Office. You expose some Java objects and then run the user's script which manipulates them. The idea is that more users will be comfortable with JavaScript. They don't need to compile anything or know how to read javadoc.

In fact, you can write JavaFX programs in Nashorn. It's not as convenient as the JavaFX Script language used to be, but it could be pretty close if someone worked at imitating the old builder syntax with nested JS objects.

In general, there are too many custom languages. Look at Processing (http://processing.org/). The graphics are great. But having to learn yet another small language, designed by well-meaning amateurs, is annoying. They didn't think a Java API would work for their user base, and I can agree with that. If they had then what we have now, they could just expose an API to JavaScript (just like the DOM API is exposed in a browser). JavaScript may not be wonderful, but it isn't terrible either, and the investment of mastering its quirks pays off elsewhere. So, if your project needs end-user scripting, check out Nashorn.

Cheers,

Cay
 
Navnish Agarwal
Greenhorn
Posts: 3
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic