SlideShare a Scribd company logo
   Sébastien Prunier
    › Architecte JEE chez Ovialis
    › Adepte des JUGs
    › Certifié Bonita OS


 @sebprunier
 gplus.to/sebprunier
 Java User Blog !
    › sebprunier.wordpress.com
   Relations avec des partenaires
    technologiques
 19h – 21h (max)
 Pot offert par Ovialis




          http://www.xebia.fr/xebia-essentials
   Ce soir nous allons donc parler de Java !
   Refactoring de code




                     Source : http://www.energizedwork.com
   Sortie officielle de Java SE 7
   JSR 334 – Project Coin
    › Evolutions du langage
   JSR 292 – InvokeDynamic
    › Support pour les langage dynamiques
   JSR 166 – Fork / Join
    › Programmation parallèle
   JSR 203 – NIO.2
    › Nouvelles APIs
   Et d’autres petites nouveautés sympa !
 Binary Literals
 Underscores in Numeric Literals
 String in switch Statements
 Multiple Catch and More Precise Rethrow
 Type Inference for Generics Instanciation
 Try-with-resource Statement
 Simplified Varargs Method Invocation
   Avant
    // 213
    int binarynumber = Integer.parseInt("11010101", 2);



   Après
    // 213
    int binarynumber = 0b11010101;
   Avant
    int bignumber = 45321589;




   Après
    int bignumber = 45_321_589;


    // 213
    int binarynumber = 0b1101_0101;
   Qui n’a pas essayé cela avant Java 7 ?
    String command = args[0];

    switch (command) {
        case "start":
            MyApplication.start();
            break;
        case "stop":
            MyApplication.stop();
            break;
        default:
            // Manage error
            break;
    }
   Objectif : factoriser !
    try {
        // Database access stuff ...
    }
    catch (ClassNotFoundException | SQLException e) {
        System.err.println("Error during database
            access : " + e.getMessage());
    }
    catch (Exception e) {
        System.err.println("Unexpected error !"
            + "Please contact the technical support");
    }
   Avant
    private void manageData()
        throws SQLException, IOException {
        // Database access, File access ...
    }

    public void myAction() throws Exception {
        try {
            manageData();
         } catch (Exception e) {
            // your stuff here !
            throw e;
        }
    }
   Après
    private void manageData()
        throws SQLException, IOException {
        // Database access, File access ...
    }

    public void myAction() throws
    SQLException, IOException {
        try {
            manageData();
         } catch (Exception e) {
            // your stuff here !
            throw e;
        }
    }
   Avant
    List<String> list = new ArrayList<String>();

    Map<String, Integer> map = new HashMap<String, Integer>();

    Map<String, List<BigDecimal>> map2 = new HashMap<String, Lis
   Après
    List<String> list = new ArrayList<>();

    Map<String, Integer> map = new HashMap<>();

    Map<String, List<BigDecimal>> map2 = new HashMap<>();
 ZE nouveauté !
 Un réel intérêt : éviter des bugs bêtes

    try (BufferedReader reader = new BufferedReader(…)) {
        String line = reader.readLine();
        while (line != null) {
            System.out.println(line);
            line = reader.readLine();
        }
    } catch (IOException e) {
        System.err.println("Erreur : " + e.getMessage());
    }


              finally{…}          close()
   java.lang.AutoCloseable

    public class MyResource implements AutoCloseable {

        ...

        @Override
        public void close() throws Exception {
            // Your stuff here !
        }
    }
   @SafeVarargs

    @SafeVarargs
    public static <T> void addToList(List<T> listArg,
                                     T... elements) {
        for (T x : elements) {
            listArg.add(x);
        }
    }




     Type safety: Potential heap pollution via varargs parameter elements
 java.util.Objects
 9 méthodes utilitaires sur les « Object »
 Un vrai + pour du code plus simple, plus
  lisible

   Deux exemple dans la démo :
    › Objects.toString()
    › Objects.hash()
> javadoc -stylesheetfile MyStylesheet.css
   Exemple de la copie de fichiers
    › java.nio.file.*

FileSystem fs = FileSystems.getDefault();
Path src = fs.getPath("/home", "source.txt");
Path tgt = fs.getPath("/backup", "target.txt");

Files.copy(src, tgt, StandardCopyOption.REPLACE_EXISTING);
   Un peu de lecture si vous le souhaitez …

http://groups.google.com/group/lescastcodeurs/msg/90ddf025c52a9412
 Tirer parti des processeurs multiples
 API de programmation parallèle
 Voir aussi
    › Map / Reduce
    › Hadoop
    › GridGain
   Approche très simple

if (my portion of the work is small enough)
    do the work directly
else
    split my work into two pieces
    invoke the two pieces and wait for the results



   Démo !


http://download.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html
   Collection Literals
     › Initialement dans Coin

 List<Integer> piDigits = [3, 1, 4, 1, 6, 5, 3, 5, 9];


 Set<Integer> primes = { 2, 7, 31, 127, 8191, 131071};


 Map<Integer, String> platonicSolids =
 { 4 : "tetrahedron", 6 : "cube", 8 : "octahedron", 12 :
 "dodecahedron", 20 : "icosahedron" };



http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001193.html
   JSR 335 – Lamba Expressions
     › Closures
     › Fonctions anonymes

        x -> x + 1
        (x) -> x + 1
        (int x) -> x + 1
        (int x, int y) -> x + y
        (x, y) -> x + y




http://mail.openjdk.java.net/pipermail/lambda-dev/2011-September/003936.html
   Modularité : Projet JIGSAW


module-info.java
module com.greetings @ 0.1 {
  requires jdk.base; // default to the highest available
  version requires org.astro @ 1.2;
  class com.greetings.Hello;
}




            http://openjdk.java.net/projects/jigsaw/
   Java 7 : Hands-On !
    › Démo sur GitHub
    › https://github.com/sebprunier/nantesjug-java7

   Java 8 : Watch !
    › Sortie prévue été 2013

   Java 9 …
   Questions / Réponses

More Related Content

What's hot

Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
Baruch Sadogursky
 
Server1
Server1Server1
Server1
FahriIrawan3
 
async/await Revisited
async/await Revisitedasync/await Revisited
async/await Revisited
Riza Fahmi
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
wahyuseptiansyah
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6
Riza Fahmi
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
Anton Arhipov
 
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 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
julien.ponge
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
Ingvar Stepanyan
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка Twisted
Maxim Kulsha
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & Android
Jordi Gerona
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6
Fiyaz Hasan
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with Javassist
Anton Arhipov
 
Java
JavaJava
devday2012
devday2012devday2012
devday2012
Juan Lopes
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
Cory Forsyth
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
Dmitry Soshnikov
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Charles Nutter
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
Thierry Wasylczenko
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
louieuser
 

What's hot (20)

Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
Server1
Server1Server1
Server1
 
async/await Revisited
async/await Revisitedasync/await Revisited
async/await Revisited
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 
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...
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка Twisted
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & Android
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with Javassist
 
Java
JavaJava
Java
 
devday2012
devday2012devday2012
devday2012
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 

Similar to Nantes Jug - Java 7

From Java 6 to Java 7 reference
From Java 6 to Java 7 referenceFrom Java 6 to Java 7 reference
From Java 6 to Java 7 reference
Giacomo Veneri
 
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
Mattias Karlsson
 
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
Rafael Winterhalter
 
What`s new in Java 7
What`s new in Java 7What`s new in Java 7
What`s new in Java 7
Georgian Micsa
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Mail.ru Group
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Mail.ru Group
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
Tomáš Kypta
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France
David Delabassee
 
JS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js AntipatternsJS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js Antipatterns
Timur Shemsedinov
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
Alex Tumanoff
 
In kor we Trust
In kor we TrustIn kor we Trust
In kor we Trust
Saúl Díaz González
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
Vaclav Pech
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 
About java
About javaAbout java
About java
Jay Xu
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
Paul King
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
Tobias Lindaaker
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
greenwop
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
David Padbury
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Doug Hawkins
 

Similar to Nantes Jug - Java 7 (20)

From Java 6 to Java 7 reference
From Java 6 to Java 7 referenceFrom Java 6 to Java 7 reference
From Java 6 to Java 7 reference
 
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
 
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
 
What`s new in Java 7
What`s new in Java 7What`s new in Java 7
What`s new in Java 7
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France
 
JS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js AntipatternsJS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js Antipatterns
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
In kor we Trust
In kor we TrustIn kor we Trust
In kor we Trust
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
About java
About javaAbout java
About java
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 

More from Sébastien Prunier

De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
Sébastien Prunier
 
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
Sébastien Prunier
 
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?
Sébastien Prunier
 
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
Sébastien Prunier
 
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
Sébastien Prunier
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
Sébastien Prunier
 
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Sébastien Prunier
 
Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10Sébastien Prunier
 
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBJugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
Sébastien Prunier
 
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Sébastien Prunier
 
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Sébastien Prunier
 
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Sébastien Prunier
 

More from Sébastien Prunier (12)

De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
 
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
 
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?
 
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
 
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
 
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
 
Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10
 
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBJugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
 
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
 
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
 
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
 

Recently uploaded

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 

Recently uploaded (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 

Nantes Jug - Java 7

  • 1.
  • 2. Sébastien Prunier › Architecte JEE chez Ovialis › Adepte des JUGs › Certifié Bonita OS  @sebprunier  gplus.to/sebprunier  Java User Blog ! › sebprunier.wordpress.com
  • 3. Relations avec des partenaires technologiques
  • 4.  19h – 21h (max)  Pot offert par Ovialis http://www.xebia.fr/xebia-essentials
  • 5.
  • 6. Ce soir nous allons donc parler de Java !
  • 7. Refactoring de code Source : http://www.energizedwork.com
  • 8. Sortie officielle de Java SE 7
  • 9. JSR 334 – Project Coin › Evolutions du langage  JSR 292 – InvokeDynamic › Support pour les langage dynamiques  JSR 166 – Fork / Join › Programmation parallèle  JSR 203 – NIO.2 › Nouvelles APIs  Et d’autres petites nouveautés sympa !
  • 10.  Binary Literals  Underscores in Numeric Literals  String in switch Statements  Multiple Catch and More Precise Rethrow  Type Inference for Generics Instanciation  Try-with-resource Statement  Simplified Varargs Method Invocation
  • 11. Avant // 213 int binarynumber = Integer.parseInt("11010101", 2);  Après // 213 int binarynumber = 0b11010101;
  • 12. Avant int bignumber = 45321589;  Après int bignumber = 45_321_589; // 213 int binarynumber = 0b1101_0101;
  • 13. Qui n’a pas essayé cela avant Java 7 ? String command = args[0]; switch (command) { case "start": MyApplication.start(); break; case "stop": MyApplication.stop(); break; default: // Manage error break; }
  • 14. Objectif : factoriser ! try { // Database access stuff ... } catch (ClassNotFoundException | SQLException e) { System.err.println("Error during database access : " + e.getMessage()); } catch (Exception e) { System.err.println("Unexpected error !" + "Please contact the technical support"); }
  • 15. Avant private void manageData() throws SQLException, IOException { // Database access, File access ... } public void myAction() throws Exception { try { manageData(); } catch (Exception e) { // your stuff here ! throw e; } }
  • 16. Après private void manageData() throws SQLException, IOException { // Database access, File access ... } public void myAction() throws SQLException, IOException { try { manageData(); } catch (Exception e) { // your stuff here ! throw e; } }
  • 17. Avant List<String> list = new ArrayList<String>(); Map<String, Integer> map = new HashMap<String, Integer>(); Map<String, List<BigDecimal>> map2 = new HashMap<String, Lis
  • 18. Après List<String> list = new ArrayList<>(); Map<String, Integer> map = new HashMap<>(); Map<String, List<BigDecimal>> map2 = new HashMap<>();
  • 19.  ZE nouveauté !  Un réel intérêt : éviter des bugs bêtes try (BufferedReader reader = new BufferedReader(…)) { String line = reader.readLine(); while (line != null) { System.out.println(line); line = reader.readLine(); } } catch (IOException e) { System.err.println("Erreur : " + e.getMessage()); } finally{…} close()
  • 20. java.lang.AutoCloseable public class MyResource implements AutoCloseable { ... @Override public void close() throws Exception { // Your stuff here ! } }
  • 21. @SafeVarargs @SafeVarargs public static <T> void addToList(List<T> listArg, T... elements) { for (T x : elements) { listArg.add(x); } } Type safety: Potential heap pollution via varargs parameter elements
  • 22.  java.util.Objects  9 méthodes utilitaires sur les « Object »  Un vrai + pour du code plus simple, plus lisible  Deux exemple dans la démo : › Objects.toString() › Objects.hash()
  • 23. > javadoc -stylesheetfile MyStylesheet.css
  • 24. Exemple de la copie de fichiers › java.nio.file.* FileSystem fs = FileSystems.getDefault(); Path src = fs.getPath("/home", "source.txt"); Path tgt = fs.getPath("/backup", "target.txt"); Files.copy(src, tgt, StandardCopyOption.REPLACE_EXISTING);
  • 25. Un peu de lecture si vous le souhaitez … http://groups.google.com/group/lescastcodeurs/msg/90ddf025c52a9412
  • 26.  Tirer parti des processeurs multiples  API de programmation parallèle  Voir aussi › Map / Reduce › Hadoop › GridGain
  • 27. Approche très simple if (my portion of the work is small enough) do the work directly else split my work into two pieces invoke the two pieces and wait for the results  Démo ! http://download.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html
  • 28. Collection Literals › Initialement dans Coin List<Integer> piDigits = [3, 1, 4, 1, 6, 5, 3, 5, 9]; Set<Integer> primes = { 2, 7, 31, 127, 8191, 131071}; Map<Integer, String> platonicSolids = { 4 : "tetrahedron", 6 : "cube", 8 : "octahedron", 12 : "dodecahedron", 20 : "icosahedron" }; http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001193.html
  • 29. JSR 335 – Lamba Expressions › Closures › Fonctions anonymes x -> x + 1 (x) -> x + 1 (int x) -> x + 1 (int x, int y) -> x + y (x, y) -> x + y http://mail.openjdk.java.net/pipermail/lambda-dev/2011-September/003936.html
  • 30. Modularité : Projet JIGSAW module-info.java module com.greetings @ 0.1 { requires jdk.base; // default to the highest available version requires org.astro @ 1.2; class com.greetings.Hello; } http://openjdk.java.net/projects/jigsaw/
  • 31. Java 7 : Hands-On ! › Démo sur GitHub › https://github.com/sebprunier/nantesjug-java7  Java 8 : Watch ! › Sortie prévue été 2013  Java 9 …
  • 32. Questions / Réponses