wood burning stoves 2.0*
The moose likes Features new in Java 8 and the fly likes Please list down the new features of Java 8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Features new in Java 8
Bookmark "Please list down the new features of Java 8 " Watch "Please list down the new features of Java 8 " New topic
Author

Please list down the new features of Java 8

Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191
Can anyone please list down the new features of Java 8?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Here's a page which appears to be a summary: http://openjdk.java.net/projects/jdk8/features
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jerin Joseph
Greenhorn

Joined: May 04, 2012
Posts: 2

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

Joined: Nov 14, 2004
Posts: 115
    
  11
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


Author of Java 8 for the Really Impatient
Jerin Joseph
Greenhorn

Joined: May 04, 2012
Posts: 2

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

Joined: Nov 14, 2004
Posts: 115
    
  11
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

Joined: Feb 10, 2014
Posts: 3
I think this will help you

http://javahungry.blogspot.com/2013/10/oracle-java-8-new-features-lambda-expressions-optional-defender-methods-example.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Please list down the new features of Java 8