I have completed 8 stages in the HTTP Server challenge and the way I currently parse the input request is like this.
String input = in.readLine();
in.readLine();
String userAgent = in.readLine();
in.readLine();
in.readLine();
String[] path = in.readLine().split("/");
If I use the below code, it just blocks the execution of the whole program.
List<String> input = new ArrayList<>();
String current;
while ((current = in.readLine()) != null) {
System.out.println(current);
input.add(current);
}
Is there a way I can make my code cleaner/elegant while it still works as expected.