Following is the coding I currently have:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class DictionarySearch{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
List<String> dicts = new ArrayList<>();
line = br.readLine();
while (line != null && !(line.trim().isEmpty())) {
dicts.add(line);
line = br.readLine();
}
System.out.println("Done adding");
String partial = br.readLine();
System.out.println("Partial: " + partial);
}
}
When I run my test, I place following values into console:
A
B
C
When I debug the code, dicts
successfully contains String A
and String B
, but I cannot make partial
equals to C
. Is it means I using the wrong class to read the input from the console?