Java7の小さな言語仕様変更(Project Coin)の詳細が決まったらしい。
Java7の細かな言語仕様の変更を扱うProject Coinですが、
色々な案が出ていたうち、採用するものが決まったそうです。
Joseph Darcy has published Project Coin's final list of approved changes to the Java language for the forthcoming version 7 release.
Project Coin Announces Final List of Small Language Changes - InfoQ
C#のusing風にリソースを扱うAutomatic Resource Managementもめでたく採用。
いちいち自前でcloseしなくても、自動的にcloseしてくれます。
try (InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest)) { byte[] buf = new byte[8192]; int n; while ((n = in.read(buf)) >= 0) out.write(buf, 0, n); }
ListやMapの初期化を、凄く簡単に書けるようになるのもありがたい。
final List<Integer> piDigits = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9]; final Map<Integer, String> platonicSolids = { 4 : "tetrahedron", 6 : "cube", 8 : "octahedron", 12 : "dodecahedron", 20 : "icosahedron" };
あと、Genericsを使ったコレクションの宣言も簡単になります。
Map<String, List<String>> anagrams = new HashMap<>();
この辺りはGoogle Collection Libraryで出来たことですが、
Java7からはライブラリなしで出来るようになりますね。
こういう小さな変更点が嬉しいのは確かですが、
Java7全体としてのポリシーとか、運営方針がどうなっていくかには
まだチョイチョイ不安が残りますけどね。