在eclipse中,这行代码编译并且程序运行良好。
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(), (List<? extends Map<String, ?>>) data, R.layout.message_list_item, from, to);
它给出了警告:
unchecked cast from ArrayList<Map> to List<? extends Map<String, ?>>
然而,在 netbeans 中:
Incompatible types: ArrayList<Map> cannot be converted to List<? extends Map<String, ?>>
然后是运行时错误:
error: inconvertible types
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(), (List<? extends Map<String, ?>>) data, R.layout.message_list_item, from, to);
required: List<? extends Map<String,?>>
found: ArrayList<Map>
有人可以向我解释这种行为差异吗?谢谢。