关于Iterator会报空指针的方法
2014-09-18 20:33
302 查看
//声明
private Iterator < String
> it = null;
//使用时应该加一个判断,不然会报空指针异常
if (mySharedpreferences.getNum() != null) {
it =
mySharedpreferences.getNum().iterator();
}
//在后面用时也加一个判断
if (it != null) {
//处理It
}
//唉,晚上弄到两点,就这一个空指针异常
,
private Iterator < String
> it = null;
//使用时应该加一个判断,不然会报空指针异常
if (mySharedpreferences.getNum() != null) {
it =
mySharedpreferences.getNum().iterator();
}
//在后面用时也加一个判断
if (it != null) {
//处理It
}
//唉,晚上弄到两点,就这一个空指针异常
,
相关文章推荐
- 关于获得MFC窗口其它类指针的方法
- 关于获得MFC窗口其它类指针的方法
- 关于指针和const限定符问题的一个简单判断方法
- C/C++中关于局部函数中更新实参指针的方法
- 关于指针及 * 运算符的一些使用方法
- 关于获得MFC窗口其它类指针的方法(CSDN)
- 关于ios中 NSString在方法中进行修改,需要传该NSString的指针的指针的问题
- 关于迭代器(iterator)和指针的思考
- 关于指针读取人物信息的简便方法
- 用C语言关于学生管理系统的几种实现方法(一位数组,二维数组,指针,结构体)
- 关于获得MFC窗口其它类指针的方法
- 关于RecordSet对象指针移动方法
- 关于获得MFC窗口其它类指针的方法
- 关于获得MFC窗口其它类指针的方法
- 一个关于指针的问题,问题很简单,但容易出错,希望大家提出好的解决方法~~~
- 关于获得MFC窗口其它类指针的方法
- 关于获得MFC窗口其它类指针的方法
- 关于迭代器(iterator)和指针的思考
- 关于s:iterator中"value" does not support runtime expressions的解决方法
- 关于hashMap遍历方法,用Iterator对hashMap进行遍历