What do I do wrong?
package pl.codegym.task.task10.task1019;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/*
Funkcjonalność to nie wszystko!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
HashMap<String, Integer> mapa = new HashMap<>();
while (true) {
int id = Integer.parseInt(reader.readLine());
String imie = reader.readLine();
String pom = String.valueOf(id);
if(pom.isEmpty()){
break;
} else if(imie.isEmpty()){
mapa.put(null, id);
}
else{
mapa.put(imie, id);
}
}
for(Map.Entry<String, Integer> x : mapa.entrySet()) {
int l = x.getValue();
String w = x.getKey();
System.out.println(l);
if(w.equals(null)){
System.out.println(l);
} else {
System.out.println(l + " " + w);
}
}
}
}