уже замучела даная задача, не могу вытянуть значения по ключу, что то не так делаю...
package com.javarush.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
/*
Модернизация ПО
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
HashMap<String, String> map = new HashMap<String, String>();
while (true) {
String city = reader.readLine();
if (city.isEmpty()) {
break;
}
String family = reader.readLine();
if (family.isEmpty()) {
break;
}
map.put(family,city);
}
// Read the house number
for(Map.Entry<String, String> pair : map.entrySet()) {
String value = pair.getValue();
String key = pair.getKey();
System.out.println(value);
System.out.println(key);
}
while (true) {
String getcity = reader.readLine();
//if (map.containsKey(getcity))
//{
String value= map.get(getcity);
System.out.println(value);
//}
if (getcity.isEmpty()) {
break;
}
}
}
}