SlideShare uma empresa Scribd logo
1 de 15
Java 8: what’s new
and what’s hot
By Sergii Maliarov
Current status
- Java 8 was released on 18 March 2014
- From October 2014 (Java SE 8 Update 25),
Java 8 has been the default version to
download on java.com
- Oracle will no longer post updates of Java
SE 7 to its public download sites after April
2015
Language-level changes
- Lambda expressions
- Functional Interfaces
- References to constructors and methods
- Default and static methods in interfaces
- Repeating annotations, type annotations
- Method parameter reflection
Lambda expressions
Lambda expression is an anonymous function that can be
assigned to a variable (not always) and be executed by
calling that variable or directly. Lambda expressions have
access to final variables from the corresponding scope.
For example, you may create the following object:
Comparator<String> strLenComp = (firstStr, secondStr) ->
Integer.compare(firstStr.length(), secondStr.length());
And then you may sort your list using that object:
Collections.sort(myListOfStrings, strLenComp);
Functional interfaces
Functional interface is an interface with only
one abstract method.
If your interface is a functional interface then
you can create a lambda function of such type
and pass it whenever you need to. Like in the
previous example.
References to constructors and
methods
You may reference a method or a constructor as a lambda-expression
● object::instanceMethod
x::equals is in fact y -> x.equals(y)
● Class::staticMethod
System.out::println is in fact x -> System.out.println(x)
● Class::instanceMethod
String::compareToIgnoreCase is in fact (x, y) ->
x.compareToIgnoreCase(y)
● Class::new
MyClass::new is in fact x -> new MyClass(x)
Default and static methods in
interfaces
The interface may declare a default
implementation of a method.
public int compareTo(T other);
public default boolean gt(T other) {
return compareTo(other) > 0;
}
And finally you may have static methods in
interfaces.
Repeating annotations, type
annotations
● It’s now possible to repeat annotation several times:
@interface Hints {Hint[] value();}
@Repeatable(Hints.class)@interface Hint {String value();}
@Hint("hint1")@Hint("hint2") class MyClass {}
In the example above class MyClass now automatically has annotation Hints.
● Also now we have two more targets for an annotation:
@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE})
@interface NotNull{}
Examples:
List<@NotNull String> nonEmptyList;
String nonEmptyString = (@NotNull String) maybeEmpty;
Method parameter reflection
Now you can obtain the names of the formal
parameters of any method or constructor with
the method
java.lang.reflect.Executable.getPar
ameters if your code is compiled with -
parameters option to the javac compiler.
What else has changed
- Stream API
- New date/time API
- Project Nashorn - JavaScript on JVM
- Tens of other small and big changes and
additions
Stream API
java.util.Stream is a sequence of elements on which you may perform intermediate (result in that
stream) or terminal (result in something else) operations. Stream can be linear or parallel. The whole
conception of stream comes from Functional Programming.
Example:
List<String> stringCollection = new ArrayList<>();
// add elements to stringCollection
long startsWithB = stringCollection.parallelStream().filter((s) ->
s.startsWith("b")).count();
Maps do not support streams. But now they have some useful methods like putIfAbsent, merge,
getOrDefault.
New date/time API
- Inspired by Joda-Time with some important differences
- use class Clock instead of java.util.Date and
System.currentTimeMillis():
Clock clock = Clock.systemDefaultZone();
long millis = clock.millis();
Instant instant = clock.instant();// time in millis
- use ZoneId to work with time zones
- use LocalTime, LocalDate, LocalDateTime and few other new
classes for purposes that can be easily guessed from their names.
- use DateTimeFormatter for thread-safe date parsing and formatting
Project Nashorn
- Compiles JS to JVM bytecode
- JavaScript may now be embedded to a Java
programm
- also allows to develop free standing
JavaScript applications using the jrunscript
command-line tool
What else was added that can be
interesting?
- Statically-linked JNI libraries
- Removal of the permanent generation
- JavaFX improvements
- New standard classes and utils ike Arrays.parallelSort,
StampedLock, CompletableFuture
- See the full list of all the changes at
http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html
What’s next
Java 9
- Somewhere in 2016
- Modularization of the JDK, several new APIs
(JSON, HTTP, Processes, etc), compiler and
JDK improvements
- See http://openjdk.java.net/projects/jdk9/ for
the full list of planned features

Mais conteúdo relacionado

Mais procurados

Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Shameer Ahmed Koya
 
Java Tutorial Lab 5
Java Tutorial Lab 5Java Tutorial Lab 5
Java Tutorial Lab 5Berk Soysal
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With ScalaKnoldus Inc.
 
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...Rishikesh Agrawani
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parametersKnoldus Inc.
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLABAnonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLABShameer Ahmed Koya
 
The Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterateThe Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iteratePhilip Schwarz
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingfarhan amjad
 

Mais procurados (20)

Java 8
Java 8Java 8
Java 8
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Matlab Programming Tips Part 1
Matlab Programming Tips Part 1
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 
C# Method overloading
C# Method overloadingC# Method overloading
C# Method overloading
 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
 
Java8 features
Java8 featuresJava8 features
Java8 features
 
Java Tutorial Lab 5
Java Tutorial Lab 5Java Tutorial Lab 5
Java Tutorial Lab 5
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
 
Java 8 Intro - Core Features
Java 8 Intro - Core FeaturesJava 8 Intro - Core Features
Java 8 Intro - Core Features
 
Java8
Java8Java8
Java8
 
Template C++ OOP
Template C++ OOPTemplate C++ OOP
Template C++ OOP
 
Templates
TemplatesTemplates
Templates
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With Scala
 
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parameters
 
Scala functions
Scala functionsScala functions
Scala functions
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLABAnonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
 
The Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterateThe Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterate
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 

Destaque

Lambda expressions java8 - yousry
Lambda expressions java8 - yousryLambda expressions java8 - yousry
Lambda expressions java8 - yousryyousry ibrahim
 
Exploring Streams and Lambdas in Java8
Exploring Streams and Lambdas in Java8Exploring Streams and Lambdas in Java8
Exploring Streams and Lambdas in Java8Isuru Samaraweera
 
Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8João Nunes
 
Java8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfaces
Java8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfacesJava8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfaces
Java8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfacesDirk Detering
 
Why is Java relevant? New features of Java8
Why is Java relevant? New features of Java8 Why is Java relevant? New features of Java8
Why is Java relevant? New features of Java8 xshyamx
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()daewon jeong
 
Introduction to functional programming with java 8
Introduction to functional programming with java 8Introduction to functional programming with java 8
Introduction to functional programming with java 8JavaBrahman
 
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation stream
JDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation streamJDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation stream
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation streamRuslan Shevchenko
 
Java8 and Functional Programming
Java8 and Functional ProgrammingJava8 and Functional Programming
Java8 and Functional ProgrammingYiguang Hu
 
Functional Java 8 in everyday life
Functional Java 8 in everyday lifeFunctional Java 8 in everyday life
Functional Java 8 in everyday lifeAndrea Iacono
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1Marut Singh
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2Marut Singh
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3Marut Singh
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8Martin Toshev
 

Destaque (20)

Java8 Lambda and Streams
Java8 Lambda and StreamsJava8 Lambda and Streams
Java8 Lambda and Streams
 
Lambda expressions java8 - yousry
Lambda expressions java8 - yousryLambda expressions java8 - yousry
Lambda expressions java8 - yousry
 
Exploring Streams and Lambdas in Java8
Exploring Streams and Lambdas in Java8Exploring Streams and Lambdas in Java8
Exploring Streams and Lambdas in Java8
 
Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8
 
Java8
Java8Java8
Java8
 
Java8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfaces
Java8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfacesJava8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfaces
Java8 Neue Sprachfeatures - Lambda/Streams/default Methods/FunctionalInterfaces
 
Why is Java relevant? New features of Java8
Why is Java relevant? New features of Java8 Why is Java relevant? New features of Java8
Why is Java relevant? New features of Java8
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
2014 java functional
2014 java functional2014 java functional
2014 java functional
 
Java8
Java8Java8
Java8
 
Introduction to functional programming with java 8
Introduction to functional programming with java 8Introduction to functional programming with java 8
Introduction to functional programming with java 8
 
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation stream
JDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation streamJDays Lviv 2014:  Java8 vs Scala:  Difference points & innovation stream
JDays Lviv 2014: Java8 vs Scala: Difference points & innovation stream
 
Java8 and Functional Programming
Java8 and Functional ProgrammingJava8 and Functional Programming
Java8 and Functional Programming
 
Functional Java 8 in everyday life
Functional Java 8 in everyday lifeFunctional Java 8 in everyday life
Functional Java 8 in everyday life
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
 
Java8 - Under the hood
Java8 - Under the hoodJava8 - Under the hood
Java8 - Under the hood
 
Java 8 Date-Time API
Java 8 Date-Time APIJava 8 Date-Time API
Java 8 Date-Time API
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 

Semelhante a Java8: what's new and what's hot

Semelhante a Java8: what's new and what's hot (20)

New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 iti
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
 
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
 
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
 
Xebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalXebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_final
 
Java 8 - An Overview
Java 8 - An OverviewJava 8 - An Overview
Java 8 - An Overview
 
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
 
java150929145120-lva1-app6892 (2).pptx
java150929145120-lva1-app6892 (2).pptxjava150929145120-lva1-app6892 (2).pptx
java150929145120-lva1-app6892 (2).pptx
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
What's new in java 8
What's new in java 8What's new in java 8
What's new in java 8
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
Java 8 Workshop
Java 8 WorkshopJava 8 Workshop
Java 8 Workshop
 
Chap-2 Classes & Methods.pptx
Chap-2 Classes & Methods.pptxChap-2 Classes & Methods.pptx
Chap-2 Classes & Methods.pptx
 
Charles Sharp: Java 8 Streams
Charles Sharp: Java 8 StreamsCharles Sharp: Java 8 Streams
Charles Sharp: Java 8 Streams
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
 

Último

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 

Último (20)

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 

Java8: what's new and what's hot

  • 1. Java 8: what’s new and what’s hot By Sergii Maliarov
  • 2. Current status - Java 8 was released on 18 March 2014 - From October 2014 (Java SE 8 Update 25), Java 8 has been the default version to download on java.com - Oracle will no longer post updates of Java SE 7 to its public download sites after April 2015
  • 3. Language-level changes - Lambda expressions - Functional Interfaces - References to constructors and methods - Default and static methods in interfaces - Repeating annotations, type annotations - Method parameter reflection
  • 4. Lambda expressions Lambda expression is an anonymous function that can be assigned to a variable (not always) and be executed by calling that variable or directly. Lambda expressions have access to final variables from the corresponding scope. For example, you may create the following object: Comparator<String> strLenComp = (firstStr, secondStr) -> Integer.compare(firstStr.length(), secondStr.length()); And then you may sort your list using that object: Collections.sort(myListOfStrings, strLenComp);
  • 5. Functional interfaces Functional interface is an interface with only one abstract method. If your interface is a functional interface then you can create a lambda function of such type and pass it whenever you need to. Like in the previous example.
  • 6. References to constructors and methods You may reference a method or a constructor as a lambda-expression ● object::instanceMethod x::equals is in fact y -> x.equals(y) ● Class::staticMethod System.out::println is in fact x -> System.out.println(x) ● Class::instanceMethod String::compareToIgnoreCase is in fact (x, y) -> x.compareToIgnoreCase(y) ● Class::new MyClass::new is in fact x -> new MyClass(x)
  • 7. Default and static methods in interfaces The interface may declare a default implementation of a method. public int compareTo(T other); public default boolean gt(T other) { return compareTo(other) > 0; } And finally you may have static methods in interfaces.
  • 8. Repeating annotations, type annotations ● It’s now possible to repeat annotation several times: @interface Hints {Hint[] value();} @Repeatable(Hints.class)@interface Hint {String value();} @Hint("hint1")@Hint("hint2") class MyClass {} In the example above class MyClass now automatically has annotation Hints. ● Also now we have two more targets for an annotation: @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) @interface NotNull{} Examples: List<@NotNull String> nonEmptyList; String nonEmptyString = (@NotNull String) maybeEmpty;
  • 9. Method parameter reflection Now you can obtain the names of the formal parameters of any method or constructor with the method java.lang.reflect.Executable.getPar ameters if your code is compiled with - parameters option to the javac compiler.
  • 10. What else has changed - Stream API - New date/time API - Project Nashorn - JavaScript on JVM - Tens of other small and big changes and additions
  • 11. Stream API java.util.Stream is a sequence of elements on which you may perform intermediate (result in that stream) or terminal (result in something else) operations. Stream can be linear or parallel. The whole conception of stream comes from Functional Programming. Example: List<String> stringCollection = new ArrayList<>(); // add elements to stringCollection long startsWithB = stringCollection.parallelStream().filter((s) -> s.startsWith("b")).count(); Maps do not support streams. But now they have some useful methods like putIfAbsent, merge, getOrDefault.
  • 12. New date/time API - Inspired by Joda-Time with some important differences - use class Clock instead of java.util.Date and System.currentTimeMillis(): Clock clock = Clock.systemDefaultZone(); long millis = clock.millis(); Instant instant = clock.instant();// time in millis - use ZoneId to work with time zones - use LocalTime, LocalDate, LocalDateTime and few other new classes for purposes that can be easily guessed from their names. - use DateTimeFormatter for thread-safe date parsing and formatting
  • 13. Project Nashorn - Compiles JS to JVM bytecode - JavaScript may now be embedded to a Java programm - also allows to develop free standing JavaScript applications using the jrunscript command-line tool
  • 14. What else was added that can be interesting? - Statically-linked JNI libraries - Removal of the permanent generation - JavaFX improvements - New standard classes and utils ike Arrays.parallelSort, StampedLock, CompletableFuture - See the full list of all the changes at http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html
  • 15. What’s next Java 9 - Somewhere in 2016 - Modularization of the JDK, several new APIs (JSON, HTTP, Processes, etc), compiler and JDK improvements - See http://openjdk.java.net/projects/jdk9/ for the full list of planned features