After trying so many times I am forced to ask for help. My code produce the correct results I think with ==, isEmpty() and str.equals("") but tests are not passing. Can anyone point to me what's wrong with my code?
Thank you.
package com.codegym.task.task10.task1019;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/*
Functionality is not enough!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
HashMap<String, Integer> map = new HashMap<String, Integer>();
int id = Integer.parseInt(reader.readLine());
String name = reader.readLine();
System.out.println("Id=" + id + " Name=" + name);
while(true)
{
String s1 = reader.readLine();
if(s1.equals(""))
{
break;
}
String s2 = reader.readLine();
if(s2.equals(""))
{
map.put(s2, Integer.parseInt(s1));
break;
}
map.put(s2, Integer.parseInt(s1));
}
for(Map.Entry<String, Integer> entry : map.entrySet())
{
System.out.println(entry.getValue() + " " + entry.getKey());
}
}
}