wtf is in java/jdk/wtf7?
DESCRIPTION
Slides for a short lightning talk I gave at Near Infinity (www.nearinfinity.com) on what exactly is in JDK7.TRANSCRIPT
![Page 1: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/1.jpg)
wtfis in Java/JDK/wtf ???7
Scott Leberknight
![Page 2: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/2.jpg)
"Making Java suck (a little) less..."
![Page 3: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/3.jpg)
jsr-203(NIO.2)
![Page 4: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/4.jpg)
java.nio.file
// old way (deprecated)File file = new File("foo.txt");
// new wayPath path = Paths.get("foo.txt");
Path path = file.toPath();
![Page 5: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/5.jpg)
FileStore
FileSystem(s)
Files(finally, you can copy a file...only took ~15 years)
![Page 6: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/6.jpg)
scalable, asynchronous I/O
socket-channel binding & config
(AsynchronousChannel & friends)
(NetworkChannel & friends)
![Page 7: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/7.jpg)
jsr-292(invokedynamic)
![Page 8: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/8.jpg)
invokestatic invokespecial
invokevirtual invokeinterface
invokedynamic (new)
invokedynamic
"...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
![Page 9: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/9.jpg)
jsr-334(Project Coin)
![Page 10: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/10.jpg)
strings in switch
switch (action) { case "Red": stop(); break; case "Yellow": slowDown(); break; case "Green": go(); break; case "Blue": danceAJig(); break;}
![Page 11: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/11.jpg)
binary literals
int clutchSong = 0b10001110101;
http://www.amazon.com/Robot-Hive-Exodus-Clutch/dp/B0009NSE1K
![Page 12: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/12.jpg)
short/byte literals
byte b = 42y;
short s = 32767s;
![Page 13: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/13.jpg)
underscores in numeric literals
long max = 9_223_372_036_854_775_807L;
int song = 0b0100_0111_0101;
![Page 14: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/14.jpg)
multi-catch
try { // code...}catch (FileNotFoundException | NoSuchFileException | AccessDeniedException ex) { // handle...}
![Page 15: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/15.jpg)
final re-throw
try { actionThatThrowsIOException(); actionThatThrowsSQLException();}catch (final Exception e) { // handle...
throw e; // IOException or SQLException}
![Page 16: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/16.jpg)
ARM
try (InputStream is = url.openStream(); OutputStream os = new FileOutputStream(file)) {
// use resources...
}
(automatic resource
management)
(AutoCloseable)
![Page 17: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/17.jpg)
diamond operator
Map<String, Map<Integer, List<String>>> things = new HashMap<>();
![Page 18: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/18.jpg)
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)
![Page 19: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/19.jpg)
java.util.Objects
Enhanced JMX agent and MBeans
honorable mention
jsr166y - Concurrency & collections updates
Method to close a URLClassLoader
Autoloading of JDBC drivers
JDBC 4.1
![Page 20: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/20.jpg)
assembly-coding
Class Loader architecture updates (parallel-capable)
Strict class file checking
Elliptic curve cryptography (ECC)
New garbage collector (lower pause times & better predictability than current CMS collector)
![Page 21: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/21.jpg)
deferreduntil JDK 8
(sometime next century)
![Page 22: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/22.jpg)
Project Lambda(a.k.a. closures)
Collection LiteralsList<Integer> items = [1, 2, 3, 4, 5];
Modularity(JSR 294 modules, formerly superpackages)
deferred
![Page 23: wtf is in Java/JDK/wtf7?](https://reader033.vdocument.in/reader033/viewer/2022052619/55658e1bd8b42a2b6d8b4edd/html5/thumbnails/23.jpg)
http://jdk7.java.net/
http://jdk7.java.net/preview/
http://download.java.net/jdk7/docs/api/
http://www.vineetmanohar.com/2011/03/installing-java-7-on-mac-os-x/
http://www.infoq.com/articles/invokedynamic
http://openjdk.java.net/projects/jdk7/features/
http://marxsoftware.blogspot.com/2011/03/jdk-7-new-interfaces-classes-enums-and.html
references