贴上部分代码:
Map<String, Map<String, Integer>> fingerprint;
Map<String, Integer> in;
in = new HashMap();
fingerprint = new HashMap();
in.put("1-TP-LINK_2348CC", -66);
in.put("1-hit404", -70);
in.put("1-441", -97);
in.put("1-422", -100);
fingerprint.put("new404", in);
//==================================================
in.clear();
in.put("2-TP-LINK_PocketAP_584322", -81);
in.put("2-Connectify-xxxx", -85);
in.put("2-441", -99);
fingerprint.put("new410", in);上面是部分代码,调试过程中,当执行完===上面的部分时fingerprint中的内容还是正常的,为:
{new404={1-422=-100, 1-TP-LINK_2348CC=-66, 1-441=-97, 1-hit404=-70}}
但是再执行完====下面的语句时,fingerprint中的内容就变成这样了:
{new410={2-Connectify-xxxx=-85, 2-441=-99, 2-TP-LINK_PocketAP_584322=-81}, new404={2-Connectify-xxxx=-85, 2-441=-99, 2-TP-LINK_PocketAP_584322=-81}}我觉得很诧异阿,为什么会是这个结果,按理说结果应该是:
{new404={1-422=-100, 1-TP-LINK_2348CC=-66, 1-441=-97, 1-hit404=-70}, new404={2-Connectify-xxxx=-85, 2-441=-99, 2-TP-LINK_PocketAP_584322=-81}}
有哪位能给解释一下,我什么地方错了?
Map<String, Map<String, Integer>> fingerprint;
Map<String, Integer> in;
in = new HashMap();
fingerprint = new HashMap();
in.put("1-TP-LINK_2348CC", -66);
in.put("1-hit404", -70);
in.put("1-441", -97);
in.put("1-422", -100);
fingerprint.put("new404", in);
//==================================================
in.clear();
in.put("2-TP-LINK_PocketAP_584322", -81);
in.put("2-Connectify-xxxx", -85);
in.put("2-441", -99);
fingerprint.put("new410", in);上面是部分代码,调试过程中,当执行完===上面的部分时fingerprint中的内容还是正常的,为:
{new404={1-422=-100, 1-TP-LINK_2348CC=-66, 1-441=-97, 1-hit404=-70}}
但是再执行完====下面的语句时,fingerprint中的内容就变成这样了:
{new410={2-Connectify-xxxx=-85, 2-441=-99, 2-TP-LINK_PocketAP_584322=-81}, new404={2-Connectify-xxxx=-85, 2-441=-99, 2-TP-LINK_PocketAP_584322=-81}}我觉得很诧异阿,为什么会是这个结果,按理说结果应该是:
{new404={1-422=-100, 1-TP-LINK_2348CC=-66, 1-441=-97, 1-hit404=-70}, new404={2-Connectify-xxxx=-85, 2-441=-99, 2-TP-LINK_PocketAP_584322=-81}}
有哪位能给解释一下,我什么地方错了?
解决方案 »
- android如何使用syncML来同步通讯录
- OpenGL ES运行出错
- android解锁软件的锁定解锁屏幕的代码
- android怎样连接oracle数据库??求源代码
- 在安装ADT时候出错!
- 关于测试activity的迁移。急!
- 【代码】android对字符串的加密和解密方法
- andriod中怎样实现跳转?下面的代码哪错了?
- 安卓手机扫描二维码,跳转到浏览器下载
- 请教大神类似于“Tue Jan 14 15:05:59 +0800 2014”这种字符串应该如何处理
- 急!求大神帮忙android调用webservice时出现soapfault faultcode
- editText控件无法获取当前输入的字符串的问题。
然后下面你又向fingerprint里面put了一个in变成这样 fingerprint.put("new410", in);相当于不仅新添加了一个in,而且你给in又赋了一次值,所以fingerprint有连个key了,而且值都是in的值。不知道我讲清楚了没有,希望能帮助到你。