jdk7新特性

2006年12月JDK6发布,2010年Oracle收购Sun,2011年7月JDK7时隔5年终于发布,也值得期待:)
语言层面
数字支持下划线分割:long x = 0x00_ff_ee, y = 3600_000;
类型推导,更简洁的范型 '<>':List list = new ArrayList<>();
switch 支持字符串:switch ("a string") { case "a": break; }
try-with-resources (AutoCloseable接口):try (InputStream in = new ByteArrayInputStream(new byte[0])) { …… }
多重catch改进:try { ... } catch (IOException | RuntimeException e) { ... }
类库改进
支持JDBC4.1和RowSet1.1
ClassLoader:为防止自定义ClassLoad在多线程中死锁,ClassLoader中增加getClassLoadingLock和registerAsParallelCapable方法
URLClassLoader: 增加close方法
java.util.concurrent包改进:轻量级fork/join,Phaser(类似CyclicBarrier和CountDownLatch但更灵活),ThreadLocalRandom
IO相关:更多新的NIO API(Files, Path, WatchService等详见java.nio.file包),支持zip/jar的FileSystemProvider,SCTP,SDP,IPv6等
Swing:nimbus外观,JLayer,不规则和透明Window等
JSR292:支持动态类型语言(InvokeDynamic)
增加 InvokeDynamic 字节码指令支持动态语言,以提升其执行速度。
G1 【jdk7新特性】避免CMS遇到的内存碎片问题,G1采用了一个可预测暂停时间模型来达到软实时。

    推荐阅读