Java 8 Officially Released

Desmond

Destroy Erase Improve
Staff member
Admin
I hope they fixed all the outstanding security bugs that have been plaguing Java for a long time.

Source : Latest JDK 8 Release Notes

Here are some new changes to the language :

- Lambda Expressions, a new language feature, has been introduced in this release. They enable you to treat functionality as a method argument, or code as data. Lambda expressions let you express instances of single-method interfaces (referred to as functional interfaces) more compactly.

- Method references provide easy-to-read lambda expressions for methods that already have a name.

- Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces.

- Repeating Annotations provide the ability to apply the same annotation type more than once to the same declaration or type use.

- Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration. Used with a pluggable type system, this feature enables improved type checking of your code.

- Improved type inference.

- Method parameter reflection.

Changes to Java tools :

- The jjs command is provided to invoke the Nashorn engine.

- The java command launches JavaFX applications.

- The java man page has been reworked.

- The jdeps command-line tool is provided for analyzing class files.

- Java Management Extensions (JMX) provide remote access to diagnostic commands.

- The jarsigner tool has an option for requesting a signed time stamp from a Time Stamping Authority (TSA).

java.lang and java.util Packages :

- Parallel Array Sorting

- Standard Encoding and Decoding Base64

- Unsigned Arithmetic Support

JDBC :

- The JDBC-ODBC Bridge has been removed.

- JDBC 4.2 introduces new features.

Java DB :

- JDK 8 includes Java DB 10.10.

Full list here : What's New in JDK 8

- - - Updated - - -

Here are some examples how Lambda expressions are used : *datumedge.blogspot.co.uk/2012/06/java-8-lambdas.html

This will make code more cleaner.
 

RBX

In the zone
So lambda expressions finally made their way into Java! The syntax looks better than the C# expressions (-> opposed to =>).
 
OP
Desmond

Desmond

Destroy Erase Improve
Staff member
Admin
I am not really familiar with lambdas since I have no background in C# or any language that supports it. I was wondering how does the compiler know the type of e?
 

RBX

In the zone
I am not really familiar with lambdas since I have no background in C# or any language that supports it. I was wondering how does the compiler know the type of e?

I'm not too sure but if this were C#, ActionListener would be a delegate specified somewhere which points to a function (here - the lambda expression/anonymous function). The delegate specifies that it points to functions that have ActionEvent as parameter, so lambda expression infers e to be of type ActionEvent.
 
Top Bottom