开发者

how do i get rid of a "Unchecked cast" warning?

开发者 https://www.devze.com 2023-04-11 05:49 出处:网络
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,?>

with the above line of code i get that unchecked cast warning. what is the best way for me to have the same results but alleviat开发者_JAVA百科e that warning?


Add this annotation to the method:

@SuppressWarnings("unchecked") // Object to Map.

Be sure to comment it -- in a large method it may not be obvious.

0

精彩评论

暂无评论...
验证码 换一张
取 消