while(setIterator.hasNext()){
String key = setIterator.next();
if(key.equalsIgnoreCase("location_id")){
containlocationid = true;
int id_key = Integer.parseInt(requestMap.get(key));
if(player.isLocationExists(id_key) == true){
player.setlocationID(Integer.parseInt(requestMap.get(key)));
responseOut.println("NOW WILL NOT BREAK AND SAVE");
}else{
responseOut.println("NOW WILL BREAK AND NO SAVE");
break;
}
}else if(key.equalsIgnoreCase("name")){
player.setName(requestMap.get(key));
responseOut.println("this is inside NAME");
}else if(key.equalsIgnoreCase("description")){
player.setDescription(requestMap.get(key));
responseOut.println("this is inside DESCRIPTION");
}
}
代码时,你得到布尔“假”,while循环将打破,并打印“现在休息,不保存”。但现在我得到这样
this is inside NAME <- this will not print out after break while loop
this is inside DESCRIPTION <- this will not print out after break while loop
NOW WILL BREAK AND NO SAVE
结果意味着,它是成功的保存和休息不干活尝试“外:” &“破外;”功能,但也失败了。
希望你明白我在说什么,请帮忙,谢谢!
请做一个正确的缩进 –
看来你的设置包含了像“name”,“description”和“location_id”这样的顺序。 isLocationExists()方法返回false – Ronald
是按照“name”,“description”,然后是“location_id”的顺序获取密钥吗?在这种情况下,我猜得到的输出是正确的 – Pai