#454 Code Review of a String Search Method in a File
Perform a code review:
boolean containsStringInData(String csvFile, String str) throw IOException {
BufferedReader reader = new BufferedReader(new FileReader(csvFile);
ArrayList<String> list = new ArrayList();
String line;
while ((line = br.readLine()) != null) {
list.add(line);
}
boolean result;
for (String s : list) {
if (s == str) {
result = true;
}
}
return result;
}
Question review
Sign in to start the dialogue
The mentor keeps the context of the current question and your previous messages.
Sign in
Available with Premium
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor