SlideShare a Scribd company logo
Presentation on
New Features in Java 8
Presented By
Dinesh Kumar Pathak
Introduction of Java:
Java is a programming language created by James
Gosling from Sun Microsystems (Sun) in 1991. The
target of Java is to write a program once and then run
this pro
The current version of Java is Java 1.8 which is also
known as Java 8.
The Java language was designed with the following
properties:
1. Platform independent
2. Object-orientated programming language
3. Interpreted and compiled language
4. Automatic memory management
Oops Concept:
Abstraction
Encapsulation
Polymorphism
Inheritance
Dynamic Binding
New Features in Java8:
forEach() method in Iterable interface.
default and static methods in interface.
Functional interfaces and lambda expression.
Java Stream API for Bulk Data Operation on
Collection.
Java Time API.
Collection API improvements.
Concurrency API improvements.
Java IO improvements.
forEach() method in Iterable interface:
Whenever we need to traverse through a Collection,
we need to create an Iterator whose whole purpose is
to iterate over
Java 8 has introduced forEach method
in java.lang.Iterable interface so that while writing
code we focus on logic only.
default and static methods in interface:
If you read forEach method details carefully, you will
notice that it’s defined in Iterable interface but we
know that interfaces can’t have method body.
 From Java 8, interfaces are enhanced to have method
with implementation. We can
use default and static keyword to create interfaces
with method implementation.
Static methods, by definition, are not abstract .
default void forEach(ClassName<? super T> action) {
}
Lambda Expression:
 Implement Functional Programming
Lambda expressions provide anonymous function types to
Java.
– Replace use of anonymous inner classes.
– Provide more functional style of programming in
Java.
doSomething(new DoStuff() {
public boolean isGood(int value) {
return value == 42;
}
});
doSomething(answer -> answer == 42);
Lambda Expressions in GUI
Applications:
 To process events in a graphical user interface (GUI) application, such as
keyboard actions, mouse actions, and scroll actions, you typically create
event handlers, which usually involves implementing a particular interface.
Often, event handler interfaces are functional interfaces; they tend to have
only one method.
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
btn.setOnAction(
event -> System.out.println("Hello World!")
);
Functional Interface:
Single Abstract Method (SAM) type
A functional interface is an interface that has one
abstract method.
– Represents a single function contract.
– Doesn’t mean it only has one method .
@FunctionalInterface annotation
– Helps ensure the functional interface
contract is honoured
– Compiler error if not a SAM
Extension Methods:
Bringing Multiple Inheritance (of Functionality) to Java
 Provide a mechanism to add new methods to existing
interfaces
– Without breaking backwards compatibility
– Gives Java multiple inheritance of behavior, as well as
types (but not state!)
public interface Set extends Collection {
public int size();
... // The rest of the existing Set methods
public T reduce(Reducer r) default Collections.setReducer;
}
Java Stream API:
A new java.util.stream has been added in Java 8 to
perform filter/map/reduce like operations with the
collection.
 This is one of the best feature because we work a lot with
Collections and usually with Big Data, we need to filter out
them based on some conditions.
Collection interface has been extended
with stream() and parallelStream() default methods to get
the Stream for sequential and parallel execution.
parallel processing will be very helpful while working with
huge collections.
Java Time API:
It has always been hard to work with Date, Time and
Time Zones in java. There was no standard approach
or API in java for date and time in Java.
One of the nice addition in Java 8 is the java.time
package that will streamline the process of working
with time in java.
One of the useful class is DateTimeFormatter for
converting date time objects to strings.
Collection API improvements:
Iterator default method
forEachRemaining(ClassName object) to perform the
given action for each remaining element until all elements
have been processed or the action throws an exception.
Collection default method removeIf(Predicate filter) to
remove all of the elements of this collection that satisfy the
given predicate.
Collection spliterator() method returning Spliterator
instance that can be used to traverse elements sequentially
or parallel.
Map replaceAll(), compute(), merge() methods.
Performance Improvement for HashMap
class with Key Collisions, how?
in case of collision till Java 7 it used to store values in
linked list and the search order for link list is O(n), but
in java 8 it forms binary tree (O(log(n))) instead of
linked list. This makes search faster, this would be
useful in case of billions of records getting collide for
same hash key.
Concurrency API improvements:
Files.list(Path dir) that returns a lazily populated
Stream, the elements of which are the entries in the
directory.
Files.lines(Path path) that reads all lines from a file as
a Stream.
Files.find() that returns a Stream that is lazily
populated with Path by searching for files in a file tree
rooted at a given starting file.
BufferedReader.lines() that return a Stream, the
elements of which are lines read from this
BufferedReader.
Nashorn JavaScript Engine:
Lightweight, high-performance JavaScript engine.
– Integrated into JRE .
Use existing javax.script API.
 New command-line tool, jjs, to run JavaScript.
It can run scripts as JavaFX applications
Native javascript arrays are untyped. Nashorn enables
you to use typed java arrays in javascript.
Some Other Features:
Comparator interface has been extended with a lot of
default and static methods for natural ordering,
reverse order etc.
min(), max() and sum() methods in Integer, Long and
Double wrapper classes.
logicalAnd(), logicalOr() and logicalXor() methods in
Boolean class.
JDBC-ODBC Bridge has been removed.
New Features in Java 8
end of presentation
Thank you
Ad

More Related Content

What's hot (20)

Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
Manav Prasad
 
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
Leninkumar Koppoju
 
Smart Migration to JDK 8
Smart Migration to JDK 8Smart Migration to JDK 8
Smart Migration to JDK 8
Geertjan Wielenga
 
The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8
Takipi
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
icarter09
 
Java8
Java8Java8
Java8
Felipe Mamud
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
LivePerson
 
Java- Updates in java8-Mazenet solution
Java- Updates in java8-Mazenet solutionJava- Updates in java8-Mazenet solution
Java- Updates in java8-Mazenet solution
Mazenetsolution
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
New York City College of Technology Computer Systems Technology Colloquium
 
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
Trung Nguyen
 
Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java
langer4711
 
Java 8
Java 8Java 8
Java 8
Sudipta K Paik
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
Talha Ocakçı
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
Nayden Gochev
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India
 
The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8
Takipi
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
icarter09
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
LivePerson
 
Java- Updates in java8-Mazenet solution
Java- Updates in java8-Mazenet solutionJava- Updates in java8-Mazenet solution
Java- Updates in java8-Mazenet solution
Mazenetsolution
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java
langer4711
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
Talha Ocakçı
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
Nayden Gochev
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India
 

Similar to New Features of JAVA SE8 (20)

Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
Mohammad Faizan
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
Nicola Pedot
 
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdfJava 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
 
Insight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FPInsight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FP
Syed Awais Mazhar Bukhari
 
whats new in java 8
whats new in java 8 whats new in java 8
whats new in java 8
Dori Waldman
 
Basic java part_ii
Basic java part_iiBasic java part_ii
Basic java part_ii
Khaled AlGhazaly
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import Java
Melody Rios
 
brief introduction to core java programming.pptx
brief introduction to core java programming.pptxbrief introduction to core java programming.pptx
brief introduction to core java programming.pptx
ansariparveen06
 
Using Java 8 on Android
Using Java 8 on AndroidUsing Java 8 on Android
Using Java 8 on Android
Eduardo Felipe Ewert Bonet
 
Stream Api.pdf
Stream Api.pdfStream Api.pdf
Stream Api.pdf
Akaks
 
Java 7 & 8
Java 7 & 8Java 7 & 8
Java 7 & 8
Ken Coenen
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
Raffi Khatchadourian
 
Java 8 - An Overview
Java 8 - An OverviewJava 8 - An Overview
Java 8 - An Overview
Indrajit Das
 
Java 8-revealed
Java 8-revealedJava 8-revealed
Java 8-revealed
Hamed Hatami
 
Java1
Java1Java1
Java1
computertuitions
 
Java
Java Java
Java
computertuitions
 
JAVA AND OOPS CONCEPTS.pptx helpful for engineering
JAVA AND OOPS CONCEPTS.pptx helpful for engineeringJAVA AND OOPS CONCEPTS.pptx helpful for engineering
JAVA AND OOPS CONCEPTS.pptx helpful for engineering
PriyanshuGupta101797
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
Digicomp Academy AG
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
Martin Odersky
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
NexThoughts Technologies
 
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdfJava 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
 
whats new in java 8
whats new in java 8 whats new in java 8
whats new in java 8
Dori Waldman
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import Java
Melody Rios
 
brief introduction to core java programming.pptx
brief introduction to core java programming.pptxbrief introduction to core java programming.pptx
brief introduction to core java programming.pptx
ansariparveen06
 
Stream Api.pdf
Stream Api.pdfStream Api.pdf
Stream Api.pdf
Akaks
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
Raffi Khatchadourian
 
Java 8 - An Overview
Java 8 - An OverviewJava 8 - An Overview
Java 8 - An Overview
Indrajit Das
 
JAVA AND OOPS CONCEPTS.pptx helpful for engineering
JAVA AND OOPS CONCEPTS.pptx helpful for engineeringJAVA AND OOPS CONCEPTS.pptx helpful for engineering
JAVA AND OOPS CONCEPTS.pptx helpful for engineering
PriyanshuGupta101797
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
Martin Odersky
 
Ad

Recently uploaded (20)

Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Ad

New Features of JAVA SE8

  • 1. Presentation on New Features in Java 8 Presented By Dinesh Kumar Pathak
  • 2. Introduction of Java: Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The target of Java is to write a program once and then run this pro The current version of Java is Java 1.8 which is also known as Java 8. The Java language was designed with the following properties: 1. Platform independent 2. Object-orientated programming language 3. Interpreted and compiled language 4. Automatic memory management
  • 4. New Features in Java8: forEach() method in Iterable interface. default and static methods in interface. Functional interfaces and lambda expression. Java Stream API for Bulk Data Operation on Collection. Java Time API. Collection API improvements. Concurrency API improvements. Java IO improvements.
  • 5. forEach() method in Iterable interface: Whenever we need to traverse through a Collection, we need to create an Iterator whose whole purpose is to iterate over Java 8 has introduced forEach method in java.lang.Iterable interface so that while writing code we focus on logic only.
  • 6. default and static methods in interface: If you read forEach method details carefully, you will notice that it’s defined in Iterable interface but we know that interfaces can’t have method body.  From Java 8, interfaces are enhanced to have method with implementation. We can use default and static keyword to create interfaces with method implementation. Static methods, by definition, are not abstract . default void forEach(ClassName<? super T> action) { }
  • 7. Lambda Expression:  Implement Functional Programming Lambda expressions provide anonymous function types to Java. – Replace use of anonymous inner classes. – Provide more functional style of programming in Java. doSomething(new DoStuff() { public boolean isGood(int value) { return value == 42; } }); doSomething(answer -> answer == 42);
  • 8. Lambda Expressions in GUI Applications:  To process events in a graphical user interface (GUI) application, such as keyboard actions, mouse actions, and scroll actions, you typically create event handlers, which usually involves implementing a particular interface. Often, event handler interfaces are functional interfaces; they tend to have only one method. btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); btn.setOnAction( event -> System.out.println("Hello World!") );
  • 9. Functional Interface: Single Abstract Method (SAM) type A functional interface is an interface that has one abstract method. – Represents a single function contract. – Doesn’t mean it only has one method . @FunctionalInterface annotation – Helps ensure the functional interface contract is honoured – Compiler error if not a SAM
  • 10. Extension Methods: Bringing Multiple Inheritance (of Functionality) to Java  Provide a mechanism to add new methods to existing interfaces – Without breaking backwards compatibility – Gives Java multiple inheritance of behavior, as well as types (but not state!) public interface Set extends Collection { public int size(); ... // The rest of the existing Set methods public T reduce(Reducer r) default Collections.setReducer; }
  • 11. Java Stream API: A new java.util.stream has been added in Java 8 to perform filter/map/reduce like operations with the collection.  This is one of the best feature because we work a lot with Collections and usually with Big Data, we need to filter out them based on some conditions. Collection interface has been extended with stream() and parallelStream() default methods to get the Stream for sequential and parallel execution. parallel processing will be very helpful while working with huge collections.
  • 12. Java Time API: It has always been hard to work with Date, Time and Time Zones in java. There was no standard approach or API in java for date and time in Java. One of the nice addition in Java 8 is the java.time package that will streamline the process of working with time in java. One of the useful class is DateTimeFormatter for converting date time objects to strings.
  • 13. Collection API improvements: Iterator default method forEachRemaining(ClassName object) to perform the given action for each remaining element until all elements have been processed or the action throws an exception. Collection default method removeIf(Predicate filter) to remove all of the elements of this collection that satisfy the given predicate. Collection spliterator() method returning Spliterator instance that can be used to traverse elements sequentially or parallel. Map replaceAll(), compute(), merge() methods.
  • 14. Performance Improvement for HashMap class with Key Collisions, how? in case of collision till Java 7 it used to store values in linked list and the search order for link list is O(n), but in java 8 it forms binary tree (O(log(n))) instead of linked list. This makes search faster, this would be useful in case of billions of records getting collide for same hash key.
  • 15. Concurrency API improvements: Files.list(Path dir) that returns a lazily populated Stream, the elements of which are the entries in the directory. Files.lines(Path path) that reads all lines from a file as a Stream. Files.find() that returns a Stream that is lazily populated with Path by searching for files in a file tree rooted at a given starting file. BufferedReader.lines() that return a Stream, the elements of which are lines read from this BufferedReader.
  • 16. Nashorn JavaScript Engine: Lightweight, high-performance JavaScript engine. – Integrated into JRE . Use existing javax.script API.  New command-line tool, jjs, to run JavaScript. It can run scripts as JavaFX applications Native javascript arrays are untyped. Nashorn enables you to use typed java arrays in javascript.
  • 17. Some Other Features: Comparator interface has been extended with a lot of default and static methods for natural ordering, reverse order etc. min(), max() and sum() methods in Integer, Long and Double wrapper classes. logicalAnd(), logicalOr() and logicalXor() methods in Boolean class. JDBC-ODBC Bridge has been removed.
  • 18. New Features in Java 8 end of presentation Thank you