HashMap<String, String> cityAndName = new HashMap<String, String>();
// 地址列表
while (true){
if (!reader.readLine().isEmpty()){
String city = reader.readLine();
String name = reader.readLine();
cityAndName.put(city,name);
}else {
break;
}
}
评论 (1)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
Misiu
17 十一月 2020, 12:24
Each reader.readLine() reads string.
if (!reader.readLine().isEmpty()) - here you read first string
String city = reader.readLine(); - here you read second string. First string is lost.
+1