Java5界から脱出した私のためのJava7紹介
Java SE 7 Features and Enhancements
- IO and New IO
- Internationalization
- Unicode 6.0.0
- java.lang Package
- Multithreaded Custom Class Loaders in Java SE 7
- Java Programming Language
- Binary Literals
- 0b
- (byte)0b00100001
- Strings in switch Statements
- case に String を取れる!
- case "Monday":
- The try-with-resources Statement
- Closableを実装しているクラスを自動でCloseしてくれる構文
- try (BufferedReader br = new BufferedReader(new FileReader(path))) {
- Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking
- 複数の例外を一発キャッチ
- catch (IOException|SQLException ex) {
- 複数の例外を一発キャッチ
- Underscores in Numeric Literals
- 3.14_15F
- Type Inference for Generic Instance Creation
- 右辺のジェネリックスを省略できる
- Map <String、List
> myMap = new HashMap <>();
- Binary Literals
- java.util.Objects