ExceptionMapping 2016-12-30 01:09 采纳率: 0%
浏览 884
已结题

list在debug模式下按一次F6就加入一次是怎么回事?

事情的起因是我在一个Data.txt文件里有如下数据:
图片说明
这是我在main里的代码:
GetLatAndLngByBaidu b = new GetLatAndLngByBaidu("");
List list = MockUtil.read("D:\Data\gongshang.txt");
// for (String string : list) {
// try {
// System.out.println(string + ":" + b.getByName(string));
// } catch (Exception e) {
// e.printStackTrace();
// }
// }

// 将经度纬度写入到文件里面
File file = new File("D:\Data\aaa.txt");

    OutputStream ot = null;

    Map<String, List> map = new HashMap<String, List>();

    ot = new FileOutputStream(file, true);
    byte[] by = null;
    for (int i = 0; i < list.size(); i++) {
        String string = list.get(i);
        string = string.replaceAll(",", "\r\n,");
        String[] str = string.split(",");

        List<String> listId = null;
        List<String> listNa = null;
        List<String> listlatlng = null;

        if (map.get("1") == null) {

// listId = new Vector();
listId = new ArrayList();
}
listId.add(str[0]);
map.put("1", listId);
if (map.get("2") == null) {
listNa = new ArrayList();
}
listNa.add(str[1]);
map.put("2", listNa);
if (map.get("3") == null) {
listlatlng = new ArrayList();
}
listlatlng.add(str[2]);
map.put("3", listlatlng);

        for (int j = 0; j < 3; j++) {
            for (String string2 : (ArrayList<String>) map.get((j + 1) + "")) {
                by = string2.getBytes();
                ot.write(by, 0, by.length);
                ot.flush();
            }
        }
    }
    if (ot != null) {
        ot.close();
    }
}
---------------我是分割线-----------------------------------------------------------
<3>然后就报错了:
![图片说明](https://img-ask.csdn.net/upload/201612/30/1483059288_111618.png)
<4>我在debug下调试:
![图片说明](https://img-ask.csdn.net/upload/201612/30/1483059514_873608.png)
<5>后面的就是按一次F6他就加一次:
![图片说明](https://img-ask.csdn.net/upload/201612/30/1483059911_437594.png)
<6>我试过向量了,没有用。还有就是可以成功写道我要写入的aaa.txt里:
![图片说明](https://img-ask.csdn.net/upload/201612/30/1483060070_265990.png)
  • 写回答

2条回答 默认 最新

  • devmiao 2016-12-30 17:02
    关注
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况