SlideShare une entreprise Scribd logo
1  sur  36
Updates in jdk 1.8
By
Sharmilee
9894303344
Java Trainer
Mazenet Solution
Objectives
• What’s new with JAVA -8
• What’s been modified with JAVA – 8
• What’s gone
What’s new with JAVA -8
1. Lambda Expression
2. Method references
3. Functional Interface
4. Default method
5. Optional
6. Parallel sort
7. Calender.Builder
Sorting in Java 8
private void sortUsingJava7(List<String> names) {
Collections.sort(names, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.compareTo(s2);
} }); }
private void sortUsingJava8(List<String> names) {
Collections.sort(names, (s1, s2) -> s1.compareTo(s2)); }
1) Lambda Introduction (new to jdk 1.8)
What is lambda?
• Lambda expression facilitates functional
programming, and simplifies the development
a lot
Syntax of lambda expression
• “ -> ” is known as lambda expression.
parameter -> expression body
Characteristics of Lambda expression
• Optional type declaration
• Optional parenthesis around parameter
• Optional curly braces
• Optional return keyword
2) Method References (new to jdk 1.8)
Method References
• It help to point to methods by their names.
• A method reference is described
using :: (double colon) symbol.
• A method reference can be used to point the
following types of methods −
Static methods
Instance methods
Constructors using new operator (TreeSet::new)
Types of method reference
Type Example Syntax
1. Reference to a static
method ContainingClass::staticMethodName Class::staticMethodName
2. Reference to a constructor ClassName::new ClassName::new
3. Reference to an instance
method of an arbitrary object
of a particular type
ContainingType::methodName Class::instanceMethodName
4. Reference to an instance
method of a particular object containingObject::instanceMethodName object::instanceMethodName
You can call the methods with their names
(references) with :: operator.
Arrays.sort(names, Test::matchStringLength);
3) Functional Interfaces
(new to jdk 1.8)
• Functional Interface have a single functionality
to exhibit.
• For example, a Comparable interface with a
single method ‘compareTo’ is used for
comparison purpose.
• Java 8 has defined a lot of functional
interfaces to be used extensively in lambda
expressions.
4) Default Methods (new to jdk 1.8)
• Java 8 introduces default method so that
List/Collection interface can have a default
implementation of forEach method,
• The class implementing these interfaces need
not implement the same.
Syntax
public interface vehicle {
default void print(){ System.out.println("I am a vehicle!");
} }
Multiple Defaults
• With default functions in interfaces, there is a
possibility that a class is implementing two
interfaces with same default methods.
public interface vehicle {
default void print(){
System.out.println("I am a vehicle!");
} }
public interface fourWheeler {
default void print(){
System.out.println("I am a four wheeler!");
} }
5) Optional (new to jdk 1.8)
• Optional is a container object which is used to
contain not-null objects.
• Optional object is used to represent null with
absent value.
• This class has various utility methods to
facilitate code to handle values as ‘available’
or ‘not available’ instead of checking null
values.
Class Declaration for java.util.Optional<T>
public final class Optional<T> extends Object
6) Parallel Sort (new to jdk 1.8)
Parallel sort
• Arrays#parallelSort uses Fork/Join framework
introduced in Java 7 to assign the sorting tasks
to multiple threads available in the thread
pool.
Difference between Arrays.sort &
Arrays.ParallelSort
1. Arrays.sort() : is a sequential sorting.
The API uses single thread for the operation.
The API takes bit longer time to perform the
operation.
2. Arrays.ParallelSort() : is a parallel sorting.
The API uses multiple threads.
The API takes lesser the time compared to Sort().
Why Parallel Sort?
• Both sort() and parallelSort() sorts the array.
• The performance with parallelSort() can be
seen when the number of arrays to sort are
very many.
7) Addition of Calender.Builder
(new to jdk 1.8)
• Before JDK 1.8, each date field is set
separately with individual methods.
• Each set method added as a separate
statement.
Calendar.Builder in jdk 1.8
Calendar calendar1 = new Calendar.Builder()
.set(Calendar.YEAR, 2013)
.set(Calendar.MONTH, 3)
.set(Calendar.DATE, 10)
.set(Calendar.HOUR, 8)
.set(Calendar.MINUTE, 56)
.set(Calendar.SECOND, 14)
.build();
• In JDK 1.8, Calendar.Builder is used to
instantiate calendar1 instance and all set
methods are used as a single statement.
• Semicolon is given only one
after build() method.
public static void DemoCalendarWithSingleSet() {
final Calendar calendar =
Calendar.getInstance(TimeZone.getTimeZone(timeZoneId), ENGLISH);
calendar.set(2013, APRIL, 6, 15, 45, 22);
out.println("Calendar via Constructor: " + stringifyCalendar(calendar));
}
Other new features
• Streams
• New Data/Time API
• Nashorn JavaScript
• Base 64
What’s gone ??
• Javax.swing.ImageIcon.Component
component
@Deprecated
• protected static final Component component
• Deprecated. since 1.8
• Do not use this shared component, which is used to track
image loading. It is left for backward compatibility only.
tracker
@Deprecated
• protected static final MediaTracker tracker
• Deprecated. since 1.8
• Do not use this shared media tracker, which is used to load
images. It is left for backward compatibility only.
Thank you!

Contenu connexe

Tendances

Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...
Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...
Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...Provectus
 
Java 8 - Project Lambda
Java 8 - Project LambdaJava 8 - Project Lambda
Java 8 - Project LambdaRahman USTA
 
Utilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automaticallyUtilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automaticallyGuo Albert
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQDoncho Minkov
 
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Martin Toshev
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryPray Desai
 
PROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part IIPROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part IISivaSankari36
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIJörn Guy Süß JGS
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigoujaxconf
 
A brief tour of modern Java
A brief tour of modern JavaA brief tour of modern Java
A brief tour of modern JavaSina Madani
 
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaJDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaSimon Ritter
 
Lambdas Hands On Lab
Lambdas Hands On LabLambdas Hands On Lab
Lambdas Hands On LabSimon Ritter
 
Jdbc presentation
Jdbc presentationJdbc presentation
Jdbc presentationnrjoshiee
 
Subconsultas
SubconsultasSubconsultas
SubconsultasMaria
 
PROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part IPROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part ISivaSankari36
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
 

Tendances (20)

Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...
Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...
Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...
 
Java 8 - Project Lambda
Java 8 - Project LambdaJava 8 - Project Lambda
Java 8 - Project Lambda
 
Utilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automaticallyUtilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automatically
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
 
Linq
LinqLinq
Linq
 
Java 8 stream and c# 3.5
Java 8 stream and c# 3.5Java 8 stream and c# 3.5
Java 8 stream and c# 3.5
 
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Concurrency Utilities in Java 8
Concurrency Utilities in Java 8
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
 
PROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part IIPROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part II
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its API
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigou
 
A brief tour of modern Java
A brief tour of modern JavaA brief tour of modern Java
A brief tour of modern Java
 
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaJDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
 
Lambdas Hands On Lab
Lambdas Hands On LabLambdas Hands On Lab
Lambdas Hands On Lab
 
PROGRAMMING IN JAVA
PROGRAMMING IN JAVAPROGRAMMING IN JAVA
PROGRAMMING IN JAVA
 
Jdbc presentation
Jdbc presentationJdbc presentation
Jdbc presentation
 
Subconsultas
SubconsultasSubconsultas
Subconsultas
 
Java 8
Java 8Java 8
Java 8
 
PROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part IPROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part I
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 

En vedette

Plato del bien comer
Plato del bien comerPlato del bien comer
Plato del bien comerAmador Perez
 
11 management lessons
11 management lessons 11 management lessons
11 management lessons Kaushal Sharma
 
Can fans tell Lollapalooza who should take the big stage?
Can fans tell Lollapalooza who should take the big stage?Can fans tell Lollapalooza who should take the big stage?
Can fans tell Lollapalooza who should take the big stage?Bo Olafsson
 
Accounting services
Accounting servicesAccounting services
Accounting serviceschris75308
 
Web Intelligence For Small and Medium Enterprises
Web Intelligence For Small and Medium EnterprisesWeb Intelligence For Small and Medium Enterprises
Web Intelligence For Small and Medium Enterprisesmicky83
 
WIRIS en plataformas online
WIRIS en plataformas onlineWIRIS en plataformas online
WIRIS en plataformas onlineWIRIS math
 
A Look at Governmental Fraud
A Look at Governmental FraudA Look at Governmental Fraud
A Look at Governmental FraudDiane Bradley
 
Slides de confiança e-medo-na-cidade-1
Slides de confiança e-medo-na-cidade-1Slides de confiança e-medo-na-cidade-1
Slides de confiança e-medo-na-cidade-1Vivi Medeiros
 
Photonics Applications - Silicon - Nanonics
Photonics Applications - Silicon - NanonicsPhotonics Applications - Silicon - Nanonics
Photonics Applications - Silicon - NanonicsDavid Lewis
 
Java Servlets
Java ServletsJava Servlets
Java ServletsEmprovise
 
Orientaciones para una buena integración de la tecnología en los centros doce...
Orientaciones para una buena integración de la tecnología en los centros doce...Orientaciones para una buena integración de la tecnología en los centros doce...
Orientaciones para una buena integración de la tecnología en los centros doce...Tajamar
 
O Propósito do Casamento
O Propósito do CasamentoO Propósito do Casamento
O Propósito do CasamentoRespirando Deus
 
Escatologia estudo 12 o juízo final
Escatologia  estudo 12   o juízo finalEscatologia  estudo 12   o juízo final
Escatologia estudo 12 o juízo finalJoao Franca
 

En vedette (16)

Plato del bien comer
Plato del bien comerPlato del bien comer
Plato del bien comer
 
11 management lessons
11 management lessons 11 management lessons
11 management lessons
 
A igreja para o mundo
A igreja para o mundoA igreja para o mundo
A igreja para o mundo
 
Can fans tell Lollapalooza who should take the big stage?
Can fans tell Lollapalooza who should take the big stage?Can fans tell Lollapalooza who should take the big stage?
Can fans tell Lollapalooza who should take the big stage?
 
Accounting services
Accounting servicesAccounting services
Accounting services
 
Web Intelligence For Small and Medium Enterprises
Web Intelligence For Small and Medium EnterprisesWeb Intelligence For Small and Medium Enterprises
Web Intelligence For Small and Medium Enterprises
 
WIRIS en plataformas online
WIRIS en plataformas onlineWIRIS en plataformas online
WIRIS en plataformas online
 
A Look at Governmental Fraud
A Look at Governmental FraudA Look at Governmental Fraud
A Look at Governmental Fraud
 
ROF_Ashok_TOC
ROF_Ashok_TOCROF_Ashok_TOC
ROF_Ashok_TOC
 
Slides de confiança e-medo-na-cidade-1
Slides de confiança e-medo-na-cidade-1Slides de confiança e-medo-na-cidade-1
Slides de confiança e-medo-na-cidade-1
 
Photonics Applications - Silicon - Nanonics
Photonics Applications - Silicon - NanonicsPhotonics Applications - Silicon - Nanonics
Photonics Applications - Silicon - Nanonics
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Orientaciones para una buena integración de la tecnología en los centros doce...
Orientaciones para una buena integración de la tecnología en los centros doce...Orientaciones para una buena integración de la tecnología en los centros doce...
Orientaciones para una buena integración de la tecnología en los centros doce...
 
O Propósito do Casamento
O Propósito do CasamentoO Propósito do Casamento
O Propósito do Casamento
 
Escatologia estudo 12 o juízo final
Escatologia  estudo 12   o juízo finalEscatologia  estudo 12   o juízo final
Escatologia estudo 12 o juízo final
 
Panorama do AT - Amós
Panorama do AT - AmósPanorama do AT - Amós
Panorama do AT - Amós
 

Similaire à Jdk 1.8 Updates Lambda Expressions Method References Functional Interfaces

Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsEmiel Paasschens
 
New Features of JAVA SE8
New Features of JAVA SE8New Features of JAVA SE8
New Features of JAVA SE8Dinesh Pathak
 
Stream Api.pdf
Stream Api.pdfStream Api.pdf
Stream Api.pdfAkaks
 
java 8 new features
java 8 new features java 8 new features
java 8 new features Rohit Verma
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8Martin Toshev
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Hirofumi Iwasaki
 
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 InterfacesRaffi Khatchadourian
 
New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 itiAhmed mar3y
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014Nayden Gochev
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8marctritschler
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Marc Tritschler
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionMazenetsolution
 
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 singhHarmeet Singh(Taara)
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8IndicThreads
 

Similaire à Jdk 1.8 Updates Lambda Expressions Method References Functional Interfaces (20)

Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
 
New Features of JAVA SE8
New Features of JAVA SE8New Features of JAVA SE8
New Features of JAVA SE8
 
Stream Api.pdf
Stream Api.pdfStream Api.pdf
Stream Api.pdf
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Lambdas in Java 8
Lambdas in Java 8Lambdas in Java 8
Lambdas in Java 8
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
 
Java 8
Java 8Java 8
Java 8
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 
Java 8 Intro - Core Features
Java 8 Intro - Core FeaturesJava 8 Intro - Core Features
Java 8 Intro - Core Features
 
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
 
New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 iti
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet Solution
 
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
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
 

Plus de Mazenetsolution

Tally Auto E-mail Module | Mazenet Technologies
Tally Auto E-mail Module | Mazenet TechnologiesTally Auto E-mail Module | Mazenet Technologies
Tally Auto E-mail Module | Mazenet TechnologiesMazenetsolution
 
Tally Auto SMS Module| Mazenet Technologies
Tally Auto SMS  Module| Mazenet TechnologiesTally Auto SMS  Module| Mazenet Technologies
Tally Auto SMS Module| Mazenet TechnologiesMazenetsolution
 
Tally auto synchronization
Tally auto synchronization Tally auto synchronization
Tally auto synchronization Mazenetsolution
 
Print barcode using voucher- Mazenettechnologies
Print barcode using voucher- MazenettechnologiesPrint barcode using voucher- Mazenettechnologies
Print barcode using voucher- MazenettechnologiesMazenetsolution
 
Copy user list | Tally | Tally Software | Accounting Software | Mazenet
Copy user list | Tally | Tally Software | Accounting Software | MazenetCopy user list | Tally | Tally Software | Accounting Software | Mazenet
Copy user list | Tally | Tally Software | Accounting Software | MazenetMazenetsolution
 
Auto synchronization | Tally Software | Mazenet Technologies
Auto synchronization | Tally Software | Mazenet TechnologiesAuto synchronization | Tally Software | Mazenet Technologies
Auto synchronization | Tally Software | Mazenet TechnologiesMazenetsolution
 
Auto backup | Tally Coimbatore | Tally Software
Auto backup | Tally Coimbatore | Tally SoftwareAuto backup | Tally Coimbatore | Tally Software
Auto backup | Tally Coimbatore | Tally SoftwareMazenetsolution
 
Mazenet Technologies-Tally
Mazenet Technologies-TallyMazenet Technologies-Tally
Mazenet Technologies-TallyMazenetsolution
 
Android - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionAndroid - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionMazenetsolution
 
Java - Servlet - Mazenet Solution
Java - Servlet - Mazenet SolutionJava - Servlet - Mazenet Solution
Java - Servlet - Mazenet SolutionMazenetsolution
 
Software Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet SolutionSoftware Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet SolutionMazenetsolution
 
Software Testing - Test management - Mazenet Solution
Software Testing - Test management - Mazenet SolutionSoftware Testing - Test management - Mazenet Solution
Software Testing - Test management - Mazenet SolutionMazenetsolution
 
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionMazenetsolution
 
PHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet SolutionPHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet SolutionMazenetsolution
 
Static testing techniques
Static testing techniquesStatic testing techniques
Static testing techniquesMazenetsolution
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solutionMazenetsolution
 
Oracle- Introduction to Sql commands- Mazenet solution
Oracle- Introduction to Sql commands- Mazenet solutionOracle- Introduction to Sql commands- Mazenet solution
Oracle- Introduction to Sql commands- Mazenet solutionMazenetsolution
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linuxMazenetsolution
 
Software Testing- Principles of testing- Mazenet Solution
Software Testing- Principles of testing- Mazenet SolutionSoftware Testing- Principles of testing- Mazenet Solution
Software Testing- Principles of testing- Mazenet SolutionMazenetsolution
 
Software Testing-Dynamic testing technique-Mazenet solution
Software Testing-Dynamic testing technique-Mazenet solutionSoftware Testing-Dynamic testing technique-Mazenet solution
Software Testing-Dynamic testing technique-Mazenet solutionMazenetsolution
 

Plus de Mazenetsolution (20)

Tally Auto E-mail Module | Mazenet Technologies
Tally Auto E-mail Module | Mazenet TechnologiesTally Auto E-mail Module | Mazenet Technologies
Tally Auto E-mail Module | Mazenet Technologies
 
Tally Auto SMS Module| Mazenet Technologies
Tally Auto SMS  Module| Mazenet TechnologiesTally Auto SMS  Module| Mazenet Technologies
Tally Auto SMS Module| Mazenet Technologies
 
Tally auto synchronization
Tally auto synchronization Tally auto synchronization
Tally auto synchronization
 
Print barcode using voucher- Mazenettechnologies
Print barcode using voucher- MazenettechnologiesPrint barcode using voucher- Mazenettechnologies
Print barcode using voucher- Mazenettechnologies
 
Copy user list | Tally | Tally Software | Accounting Software | Mazenet
Copy user list | Tally | Tally Software | Accounting Software | MazenetCopy user list | Tally | Tally Software | Accounting Software | Mazenet
Copy user list | Tally | Tally Software | Accounting Software | Mazenet
 
Auto synchronization | Tally Software | Mazenet Technologies
Auto synchronization | Tally Software | Mazenet TechnologiesAuto synchronization | Tally Software | Mazenet Technologies
Auto synchronization | Tally Software | Mazenet Technologies
 
Auto backup | Tally Coimbatore | Tally Software
Auto backup | Tally Coimbatore | Tally SoftwareAuto backup | Tally Coimbatore | Tally Software
Auto backup | Tally Coimbatore | Tally Software
 
Mazenet Technologies-Tally
Mazenet Technologies-TallyMazenet Technologies-Tally
Mazenet Technologies-Tally
 
Android - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionAndroid - Intents - Mazenet Solution
Android - Intents - Mazenet Solution
 
Java - Servlet - Mazenet Solution
Java - Servlet - Mazenet SolutionJava - Servlet - Mazenet Solution
Java - Servlet - Mazenet Solution
 
Software Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet SolutionSoftware Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet Solution
 
Software Testing - Test management - Mazenet Solution
Software Testing - Test management - Mazenet SolutionSoftware Testing - Test management - Mazenet Solution
Software Testing - Test management - Mazenet Solution
 
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet Solution
 
PHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet SolutionPHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet Solution
 
Static testing techniques
Static testing techniquesStatic testing techniques
Static testing techniques
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solution
 
Oracle- Introduction to Sql commands- Mazenet solution
Oracle- Introduction to Sql commands- Mazenet solutionOracle- Introduction to Sql commands- Mazenet solution
Oracle- Introduction to Sql commands- Mazenet solution
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linux
 
Software Testing- Principles of testing- Mazenet Solution
Software Testing- Principles of testing- Mazenet SolutionSoftware Testing- Principles of testing- Mazenet Solution
Software Testing- Principles of testing- Mazenet Solution
 
Software Testing-Dynamic testing technique-Mazenet solution
Software Testing-Dynamic testing technique-Mazenet solutionSoftware Testing-Dynamic testing technique-Mazenet solution
Software Testing-Dynamic testing technique-Mazenet solution
 

Dernier

Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 

Dernier (20)

Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 

Jdk 1.8 Updates Lambda Expressions Method References Functional Interfaces

  • 1. Updates in jdk 1.8 By Sharmilee 9894303344 Java Trainer Mazenet Solution
  • 2. Objectives • What’s new with JAVA -8 • What’s been modified with JAVA – 8 • What’s gone
  • 4. 1. Lambda Expression 2. Method references 3. Functional Interface 4. Default method 5. Optional 6. Parallel sort 7. Calender.Builder
  • 6. private void sortUsingJava7(List<String> names) { Collections.sort(names, new Comparator<String>() { @Override public int compare(String s1, String s2) { return s1.compareTo(s2); } }); } private void sortUsingJava8(List<String> names) { Collections.sort(names, (s1, s2) -> s1.compareTo(s2)); }
  • 7. 1) Lambda Introduction (new to jdk 1.8)
  • 8. What is lambda? • Lambda expression facilitates functional programming, and simplifies the development a lot
  • 9. Syntax of lambda expression • “ -> ” is known as lambda expression. parameter -> expression body
  • 10. Characteristics of Lambda expression • Optional type declaration • Optional parenthesis around parameter • Optional curly braces • Optional return keyword
  • 11. 2) Method References (new to jdk 1.8)
  • 12. Method References • It help to point to methods by their names. • A method reference is described using :: (double colon) symbol. • A method reference can be used to point the following types of methods − Static methods Instance methods Constructors using new operator (TreeSet::new)
  • 13. Types of method reference Type Example Syntax 1. Reference to a static method ContainingClass::staticMethodName Class::staticMethodName 2. Reference to a constructor ClassName::new ClassName::new 3. Reference to an instance method of an arbitrary object of a particular type ContainingType::methodName Class::instanceMethodName 4. Reference to an instance method of a particular object containingObject::instanceMethodName object::instanceMethodName
  • 14. You can call the methods with their names (references) with :: operator. Arrays.sort(names, Test::matchStringLength);
  • 16. • Functional Interface have a single functionality to exhibit. • For example, a Comparable interface with a single method ‘compareTo’ is used for comparison purpose. • Java 8 has defined a lot of functional interfaces to be used extensively in lambda expressions.
  • 17. 4) Default Methods (new to jdk 1.8)
  • 18. • Java 8 introduces default method so that List/Collection interface can have a default implementation of forEach method, • The class implementing these interfaces need not implement the same.
  • 19. Syntax public interface vehicle { default void print(){ System.out.println("I am a vehicle!"); } }
  • 20. Multiple Defaults • With default functions in interfaces, there is a possibility that a class is implementing two interfaces with same default methods.
  • 21. public interface vehicle { default void print(){ System.out.println("I am a vehicle!"); } } public interface fourWheeler { default void print(){ System.out.println("I am a four wheeler!"); } }
  • 22. 5) Optional (new to jdk 1.8)
  • 23. • Optional is a container object which is used to contain not-null objects. • Optional object is used to represent null with absent value. • This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values.
  • 24. Class Declaration for java.util.Optional<T> public final class Optional<T> extends Object
  • 25. 6) Parallel Sort (new to jdk 1.8)
  • 26. Parallel sort • Arrays#parallelSort uses Fork/Join framework introduced in Java 7 to assign the sorting tasks to multiple threads available in the thread pool.
  • 27. Difference between Arrays.sort & Arrays.ParallelSort 1. Arrays.sort() : is a sequential sorting. The API uses single thread for the operation. The API takes bit longer time to perform the operation. 2. Arrays.ParallelSort() : is a parallel sorting. The API uses multiple threads. The API takes lesser the time compared to Sort().
  • 28. Why Parallel Sort? • Both sort() and parallelSort() sorts the array. • The performance with parallelSort() can be seen when the number of arrays to sort are very many.
  • 29. 7) Addition of Calender.Builder (new to jdk 1.8)
  • 30. • Before JDK 1.8, each date field is set separately with individual methods. • Each set method added as a separate statement.
  • 31. Calendar.Builder in jdk 1.8 Calendar calendar1 = new Calendar.Builder() .set(Calendar.YEAR, 2013) .set(Calendar.MONTH, 3) .set(Calendar.DATE, 10) .set(Calendar.HOUR, 8) .set(Calendar.MINUTE, 56) .set(Calendar.SECOND, 14) .build();
  • 32. • In JDK 1.8, Calendar.Builder is used to instantiate calendar1 instance and all set methods are used as a single statement. • Semicolon is given only one after build() method.
  • 33. public static void DemoCalendarWithSingleSet() { final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(timeZoneId), ENGLISH); calendar.set(2013, APRIL, 6, 15, 45, 22); out.println("Calendar via Constructor: " + stringifyCalendar(calendar)); }
  • 34. Other new features • Streams • New Data/Time API • Nashorn JavaScript • Base 64
  • 35. What’s gone ?? • Javax.swing.ImageIcon.Component component @Deprecated • protected static final Component component • Deprecated. since 1.8 • Do not use this shared component, which is used to track image loading. It is left for backward compatibility only. tracker @Deprecated • protected static final MediaTracker tracker • Deprecated. since 1.8 • Do not use this shared media tracker, which is used to load images. It is left for backward compatibility only.