after cracking my head open I finally managed a way out of the while loop, yet I'm still unable to "not lose the last number" and I don't understand why... please help
package com.codegym.task.task10.task1019;
import java.io.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
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> newMap = new HashMap<>();
do { //this is stupid
int id = Integer.parseInt(reader.readLine());
String name = reader.readLine();
newMap.put(name, id);
//much like this.
// But I can't seem to get it working without the break.
} while (!newMap.containsKey(""));
for (Map.Entry<String, Integer> pair : newMap.entrySet()) { //I love these for each loops haha
System.out.println( " ID= " + pair.getValue() + "Name= " + pair.getKey());
}
}
}