0
Map<String,?> one = (Map<String,?>) parent.getAdapter().getItem(position);
Type safety: Unchecked cast from Object to Map<String,?>
我如何擺脫「未經檢查的投射」警告?
與上面的代碼行我得到選中鑄警告。對我來說,獲得相同結果但減輕警告的最佳方式是什麼?
Map<String,?> one = (Map<String,?>) parent.getAdapter().getItem(position);
Type safety: Unchecked cast from Object to Map<String,?>
我如何擺脫「未經檢查的投射」警告?
與上面的代碼行我得到選中鑄警告。對我來說,獲得相同結果但減輕警告的最佳方式是什麼?
此標註添加到方法:
@SuppressWarnings("unchecked") // Object to Map.
務必評論它 - 在一個大的方法,它可能不是很明顯。
thx工作。 – texasman1979
可能重複的[類型安全:未經檢查的轉換](http://stackoverflow.com/questions/262367/type-safety-unchecked-cast) –
「父」的類型是什麼? –