您的位置:首页 > 其它

关于Iterator会报空指针的方法

2014-09-18 20:33 302 查看
//声明

private Iterator < String
> it = null;

//使用时应该加一个判断,不然会报空指针异常

if (mySharedpreferences.getNum() != null) {

it =
mySharedpreferences.getNum().iterator();

}

//在后面用时也加一个判断

if (it != null) {

//处理It

}

//唉,晚上弄到两点,就这一个空指针异常

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: