SlideShare a Scribd company logo
1 of 9
Java 7 New Features
Diamond Operator




Map<String, List<Offer>> offers = new HashMap<>();
Strings in switch statements
String status = offer.getStatus();
switch(status) {
case NEW:
   newOffer(offer);             Case Label
  break;
case PENDING:               toString()
   pendingOffer(offer);
  break;
default:
  break;
}
Automatic Resource
                Management

 Automatic close                             Multiple Resources
try(FileOutputStream fos = new FileOutputStream(“movies.txt”);
DataOutputStream dos = new DataOutputStream(fos)) {
   dos.writeUTF(“Java 7 New Features”)
} catch (IOException e) {
   ...
}
              Implements java.lang.AutoCloseable


      try-with-resources statement
Numeric literals with
   underscore



     int thousand = 1_000;
    int million = 1_000_000;
Binary literals




      int two = 0b10;
 int forty = 0b101_000;
Improved exception handling



try {
   methodThatThrowsThreeExceptions();
} catch (ExceptionOne | ExceptionTwo | ExceptionThree e) {
   ...
}



                     Multi-catch block
NIO 2.0
●   Working with Path: Path, Paths,
    FileSystem, FileSystems, ...
●   File change notifications: WatchService,
    WatchKey
Fork and Join Framework
●   ForkJoinPool        int numberOfProcessors =
                        Runtime.getRunTime().availableProcessors();
●    RecursiveAction    ForkJoinPool pool = new
    (void compute())    ForkJoinPool(numberOfProcessors)

                        …
●    RecursiveTask<V>
                        public class BigProblemTask extends
    (V compute())       RecursiveAction {

                            @Override

                            protected void compute() {

                            // your problem invocation goes here

                            }

                        }

                        …

                        pool.invoke(task);

More Related Content

What's hot

NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
Teerawat Issariyakul
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
Malikireddy Bramhananda Reddy
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
Michael Lehmann
 
Reacting with ReactiveUI
Reacting with ReactiveUIReacting with ReactiveUI
Reacting with ReactiveUI
kiahiska
 

What's hot (20)

Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
...Lag
...Lag...Lag
...Lag
 
Леонид Шевцов «Clojure в деле»
Леонид Шевцов «Clojure в деле»Леонид Шевцов «Clojure в деле»
Леонид Шевцов «Clojure в деле»
 
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJS
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
 
Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
 
Reactive x
Reactive xReactive x
Reactive x
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
 
Openstack taskflow 簡介
Openstack taskflow 簡介Openstack taskflow 簡介
Openstack taskflow 簡介
 
Oop lecture9 13
Oop lecture9 13Oop lecture9 13
Oop lecture9 13
 
Introduction to ES6 with Tommy Cresine
Introduction to ES6 with Tommy CresineIntroduction to ES6 with Tommy Cresine
Introduction to ES6 with Tommy Cresine
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
 
JavaScript @ CTK
JavaScript @ CTKJavaScript @ CTK
JavaScript @ CTK
 
Reacting with ReactiveUI
Reacting with ReactiveUIReacting with ReactiveUI
Reacting with ReactiveUI
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
 

Viewers also liked

Operational efficiencies stefan baciu
Operational efficiencies stefan baciuOperational efficiencies stefan baciu
Operational efficiencies stefan baciu
Adela Marin
 
الكسور
الكسورالكسور
الكسور
naila600
 
Gpx design solutions (2)
Gpx design solutions (2)Gpx design solutions (2)
Gpx design solutions (2)
Suzie Are
 
14.03.28 Exegesis - Lent 3
14.03.28 Exegesis - Lent 314.03.28 Exegesis - Lent 3
14.03.28 Exegesis - Lent 3
morrisenglish
 

Viewers also liked (20)

Rafa
RafaRafa
Rafa
 
Presentación merry christmas
Presentación merry christmasPresentación merry christmas
Presentación merry christmas
 
Gestion des fichiers
Gestion des fichiersGestion des fichiers
Gestion des fichiers
 
Lb2
Lb2Lb2
Lb2
 
Doritos
DoritosDoritos
Doritos
 
Inspire awards 2011
Inspire awards 2011Inspire awards 2011
Inspire awards 2011
 
Benefit solutions for government contractors
Benefit solutions for government contractorsBenefit solutions for government contractors
Benefit solutions for government contractors
 
16 parents expectation from child
16 parents expectation from child16 parents expectation from child
16 parents expectation from child
 
Galaxy Assists Program
Galaxy Assists ProgramGalaxy Assists Program
Galaxy Assists Program
 
7º pag82 113
7º pag82 1137º pag82 113
7º pag82 113
 
Presentation ciwit
Presentation ciwitPresentation ciwit
Presentation ciwit
 
Child Protection Rapid Assessment Data Analysis Template
Child Protection Rapid Assessment Data Analysis TemplateChild Protection Rapid Assessment Data Analysis Template
Child Protection Rapid Assessment Data Analysis Template
 
Operational efficiencies stefan baciu
Operational efficiencies stefan baciuOperational efficiencies stefan baciu
Operational efficiencies stefan baciu
 
Roche Bros. Supermarket Social Media
Roche Bros. Supermarket Social MediaRoche Bros. Supermarket Social Media
Roche Bros. Supermarket Social Media
 
الكسور
الكسورالكسور
الكسور
 
Gpx design solutions (2)
Gpx design solutions (2)Gpx design solutions (2)
Gpx design solutions (2)
 
Life is a journey of ecstasy
Life is a journey of ecstasyLife is a journey of ecstasy
Life is a journey of ecstasy
 
Reddiar mail inside and cover
Reddiar mail inside and coverReddiar mail inside and cover
Reddiar mail inside and cover
 
14.03.28 Exegesis - Lent 3
14.03.28 Exegesis - Lent 314.03.28 Exegesis - Lent 3
14.03.28 Exegesis - Lent 3
 
Bloggy Conference 2014
Bloggy Conference 2014Bloggy Conference 2014
Bloggy Conference 2014
 

Similar to Java 7 new features

Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
julien.ponge
 

Similar to Java 7 new features (20)

Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
JDK1.7 features
JDK1.7 featuresJDK1.7 features
JDK1.7 features
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
 
COScheduler In Depth
COScheduler In DepthCOScheduler In Depth
COScheduler In Depth
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
 
JAVA SE 7
JAVA SE 7JAVA SE 7
JAVA SE 7
 
Java
JavaJava
Java
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
 
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnGoptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
The uniform interface is 42
The uniform interface is 42The uniform interface is 42
The uniform interface is 42
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Java 7 new features

  • 1. Java 7 New Features
  • 2. Diamond Operator Map<String, List<Offer>> offers = new HashMap<>();
  • 3. Strings in switch statements String status = offer.getStatus(); switch(status) { case NEW: newOffer(offer); Case Label break; case PENDING: toString() pendingOffer(offer); break; default: break; }
  • 4. Automatic Resource Management Automatic close Multiple Resources try(FileOutputStream fos = new FileOutputStream(“movies.txt”); DataOutputStream dos = new DataOutputStream(fos)) { dos.writeUTF(“Java 7 New Features”) } catch (IOException e) { ... } Implements java.lang.AutoCloseable try-with-resources statement
  • 5. Numeric literals with underscore int thousand = 1_000; int million = 1_000_000;
  • 6. Binary literals int two = 0b10; int forty = 0b101_000;
  • 7. Improved exception handling try { methodThatThrowsThreeExceptions(); } catch (ExceptionOne | ExceptionTwo | ExceptionThree e) { ... } Multi-catch block
  • 8. NIO 2.0 ● Working with Path: Path, Paths, FileSystem, FileSystems, ... ● File change notifications: WatchService, WatchKey
  • 9. Fork and Join Framework ● ForkJoinPool int numberOfProcessors = Runtime.getRunTime().availableProcessors(); ● RecursiveAction ForkJoinPool pool = new (void compute()) ForkJoinPool(numberOfProcessors) … ● RecursiveTask<V> public class BigProblemTask extends (V compute()) RecursiveAction { @Override protected void compute() { // your problem invocation goes here } } … pool.invoke(task);