int j = 0;
List<Integer> i = j > 0 ? Collections.emptyList() : new ArrayList<Integer>(); // compiler error:cannot convert from List<capture#1-of ? extends Object> to List<Integer>
List<Integer> li = Collections.emptyList(); // it works
雖然我知道是什麼類型擦除,我不原因編譯失敗!
幫助,thx!
相關問題:http://stackoverflow.com/questions/306713/java-collections-emptylist-returns-a-listobject –