wtf is in Java/JDK/wtf7?

3,835 views

Published on

Slides for a short lightning talk I gave at Near Infinity (www.nearinfinity.com) on what exactly is in JDK7.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
3,835
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
43
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

wtf is in Java/JDK/wtf7?

  1. 1. wtf is in Java/JDK/wtf 7 ??? Scott Leberknight
  2. 2. "Making Java suck (a little) less..."
  3. 3. jsr-203(NIO.2)
  4. 4. // old way (deprecated)File file = new File("foo.txt");// new wayPath path = Paths.get("foo.txt");Path path = file.toPath();java.nio.file
  5. 5. Files(finally, you can copy a file...only took ~15 years)FileSystem(s)FileStore
  6. 6. scalable, asynchronous I/O (AsynchronousChannel & friends)socket-channel binding& config(NetworkChannel & friends)
  7. 7. jsr-292(invokedynamic)
  8. 8. invokedynamicinvokestatic invokespecialinvokevirtual invokeinterfaceinvokedynamic (new) "...an invokedynamic instruction is used to call methods which have linkage and dispatch semantics defined by non-Java languages..." - http://www.infoq.com/articles/invokedynamic
  9. 9. jsr-334 (Project Coin)
  10. 10. strings in switchswitch (action) { case "Red": stop(); break; case "Yellow": slowDown(); break; case "Green": go(); break; case "Blue": danceAJig(); break;}
  11. 11. binary literalsint clutchSong = 0b10001110101; http://www.amazon.com/Robot-Hive-Exodus-Clutch/dp/B0009NSE1K
  12. 12. short/byte literalsbyte b = 42y;short s = 32767s;
  13. 13. underscores in numeric literalslong max = 9_223_372_036_854_775_807L;int song = 0b0100_0111_0101;
  14. 14. multi-catchtry { // code...}catch (FileNotFoundException | NoSuchFileException | AccessDeniedException ex) { // handle...}
  15. 15. final re-throwtry { actionThatThrowsIOException(); actionThatThrowsSQLException();}catch (final Exception e) { // handle... throw e; // IOException or SQLException}
  16. 16. ARM (automatic resource management)try (InputStream is = url.openStream(); OutputStream os = new FileOutputStream(file)) { // use resources...} (AutoCloseable)
  17. 17. diamond operatorMap<String, Map<Integer, List<String>>> things = new HashMap<>();
  18. 18. modified JSRsJava Compiler API (jsr 199)JAXP 1.3 (jsr 206)JAXB 2.2 (jsr 222)JAX-WS 2.2 (jsr 224)Pluggable Annotation Processing (jsr 269)
  19. 19. honorable mentionjava.util.Objects jsr166y - Concurrency & collections updatesEnhanced JMX agent andMBeans Autoloading of JDBC driversMethod to close aURLClassLoader JDBC 4.1
  20. 20. assembly-codingClass Loader architecture updates (parallel-capable)Strict class file checkingElliptic curve cryptography (ECC)New garbage collector (lower pause times & betterpredictability than current CMS collector)
  21. 21. deferred until JDK 8 (sometime next century)
  22. 22. Project Lambda re d r (a.k.a. closures)de fe Collection Literals List<Integer> items = [1, 2, 3, 4, 5]; Modularity (JSR 294 modules, formerly superpackages)
  23. 23. referenceshttp://jdk7.java.net/http://openjdk.java.net/projects/jdk7/features/http://jdk7.java.net/preview/http://download.java.net/jdk7/docs/api/http://www.infoq.com/articles/invokedynamichttp://www.vineetmanohar.com/2011/03/installing-java-7-on-mac-os-x/http://marxsoftware.blogspot.com/2011/03/jdk-7-new-interfaces-classes-enums-and.html
  24. 24. (the end)scott.leberknight@nearinfinity.comwww.nearinfinity.com/blogs/twitter: sleberknight

×