2008-03-03から1日間の記事一覧

3項演算子とジェネリクスの戻り値形依存タイプとの相性

組み合わせによってイヤンな場合があるようだ。 // (1) Set<String> hoges1 = Collections.emptySet(); //--> OK // (2) Set<String> hoges2 = (true) ? Collections.emptySet() : new HashSet<String>(); //-->NG:コンパイルエラー // (3) Set<String> hoges3; if (true) { hoges3 = Collect</string></string></string></string>…