I have a text file that has these two lines:
PC Looks like the killer was panicking and searched for help as soon as he could......
Cupboard I understand this is quite the scene to stomach for your first mystery
Using BufferedReader, I would like to save the first word (PC for example) as a HashMap key and the following sentence as its value.
I have searched online for the answer to this and I found a question, created by Rumen, that was answered very similarly to what I was looking for. However, they used line.split() which would only work if I had something like:
PC On
as that would save PC as the key and On as the value. Secondly, user funglejunk, another answer used ProcessInformation (as a parameter for list) and I have not learnt about that yet (but will put it on the list!.)
Here is the answer I am reffering to.
Appreciate all help!
String key = line.substring(0, line.indexOf(' '));
String value = line.substring(line.indexOf(' ') + 1);