明日から使える java se 7
DESCRIPTION
TRANSCRIPT
明日から使える
Java in the Box
櫻庭 祐一
Java 7SE
祝7/28JavaSE7リリース
リリース
ほんとは
2008 年
予定だったけど
なぜ遅れた
機能 Project LambdaProject Jigsaw
買収
移行 JDK OpenJDK
JavaFX?
Java SE 7 Themes
Compatibility
Productivity
Performance
Universality
Integration
Project Coin
G1GC JSR166y
InvokeDynamic
NIO2
+1Try-with-resources
Multi Catch/Precise Rethrow
NIO2
Upgrade ClassLoader
+1try (InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest)) {
byte[] buf = new byte[1024]; int n; while((n = in.read(buf)) >= 0) { out.write(buf, 0, n); }} catch (IOException ex) { // 例外処理}
try-with-resources
+1try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(stream);
// パース } catch (final IOException | IllegalArgumentException | ParserConfigurationException | SAXException ex) { log(ex); throw ex;}
Multi Catch/Precise Rethrow
+1Path start = ...;
String regex = ...;
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
public FileVisitResult visitFile(Path path,
BasicFileAttributes attrs) throws IOException {
if (Pattern.matches(regex,
path.getFileName().toString()) {
System.out.println("File: " + path);
}
return FileVisitResult.CONTINUE;
}});
NIO2 FileVisitor を使ったファイルの検索
+0.5Diamond Operator
数値リテラル
<>
+0.5javafx.scene.control.Button button = new Button("OK");
EventHandler<ActionEvent> handler = new EventHandler<>() { public void handle(ActionEvent t) { // イベント処理 }};button.setOnAction(handler);
button.setOnAction(new EventHandler<>() { public void handle(ActionEvent t) { // イベント処理 }});
道半ばJSR166y Fork/Join FrameworkJSR292 InvokeDynamic
JSR335 Project Lambda
実戦投入一歩手前Garbage First Garbage Collection (G1GC)
微妙 ...String Switch
JDBC 4.1MXBean 拡張
Nimbus L&F
プラットフォーム依存SCTP/SDP
Unicode 6.0
なぜなくなった !!
XML リテラルJSR255 JMX 2.0
JSR296 Beans Binding
JSR303 Bean Validation
JSR274 BeanShell Script Language
JSR260 Javadoc
なぜなくなった !!
XML リテラルJSR255 JMX 2.0
JSR296 Beans Binding
JSR303 Bean Validation
JSR274 BeanShell Script Language
JSR260 Javadocコードネームもなくなった
Conclusion全体的に小粒のアップデート
Java SE 8 につながる技術に注目
ファイルを扱うなら NIO2!!
いきなり Java SE 8 はつらいよ
参考ITpro Java SE 7 徹底理解
明日から使える
Java in the Box櫻庭 祐一
Java 7SE