Java 8 - KNOWARTH

28
SLIDE TITLE Click to edit Master text styles Second level Third level Fourth level Fifth level By Dinesh Radadiya Java 8

Transcript of Java 8 - KNOWARTH

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

By Dinesh Radadiya

Java 8

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

2

Lambda Expressions

Default Methods

Date & Time API

Streams

Nashorn JavaScript Engine

PermGen to Metaspace

Agenda

© 2014 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

3

Lambda Expression

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

4

It is similar to method; it has Arguments, a Body and Return type.

It also called as anonymous methods, A method without name.

It enables passing a Method as an argument to another Method.

What is Lambda Expression?

© 2014 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

5© 2013 Knowarth

Why do we need Lambda Expression ?

Reduced Line of Code.

Sequential and Parallel Execution Support.

Passing Behaviours into Methods.

Replace anonymous class.

More readable and reusable code.

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

6© 2013 Knowarth

Sample Code

Lambda Expression

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

7© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

8© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

9© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10

Default Methods

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

11

It is possible to add method bodies into Interfaces!

What is Default Methods?

© 2013 Knowarth

Why we need Default Methods?

What about Multiple Inheritance?

Now what are the Different between Abstract class and

Inheritance?

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

12

Date & Time API

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

13

Java Date & Time are not defined consistently.

There are no clearly defined classes for time, timestamp,

formatting and parsing.

All the Date classes are mutable, so they are not thread

safe.

Date class doesn’t provide internationalization, there is no

Time-Zone support.

Why do we need new Date & Time API?

© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

14

Immutability.

Separation of Concerns.

Clarity

Utility Operations

Expendability

What are the new features?

© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

15© 2013 Knowarth

Sample Code

Date & Time

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

16© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

17

Streams(java.util.stream)

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

18

For Internal Iteration.

It has various Filtering and mapping methods which increase

efficiency

Why it is required?

© 2013 Knowarth

Before Java 8

After Java 8

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

19

Nashorn JavaScript Engine

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

20

Ability to communicate to java directly.

It can be used java using “javax.script” API

It also can be used new command line tool jjs.

It support Full JavaFx

Features

© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

21© 2013 Knowarth

Sample Code

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

22© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

23© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

24

PermGen To Metaspace

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

25

This memory space is completely removed.

No more java.lang.OutOfMemoryError: PermGen.

The PermSize and MaxPermSize JVM arguments are ignored

and a warning is issued if present at start-up

PermGen Space

© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

26

Class metadata are now allocated to available native

memory.

MaxMetaspaceSize

Dynamically re-size at runtime.

Metaspace

© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

QUERY & QUESTIONS

27© 2013 Knowarth

SLIDE TITLE

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

THANK YOU