[Files and Dictionaries] 01.OddLines
Reading files...
Comparing files...
line match -> In fair Verona, where we lay our scene
mismatch -> expected{Where civil blood makes civil hands unclean. }, actual{Where civil blood makes civil hands unclean.}
mismatch -> expected{A pair of star-cross'd lovers take their life }, actual{A pair of star-cross'd lovers take their life}
line match -> Do with their death bury their parents' strife.�
Защо ми изрязва този интервал , при другите тестове нямам проблем .
Toва е частта с четенето и записването.
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(new File("res\\02_OddLines\\02_OddLinesIn.txt")));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File("res\\02_OddLines\\MyOutputTest2.txt")))) {
int index = 0;
String line = "";
ArrayList<String> lines = new ArrayList<>();
while((line = bufferedReader.readLine())!=null){
if(index%2==1){
lines.add(line);
}
index++;
}
for(String oddLine : lines){
bufferedWriter.write(oddLine + "\n");
}
} catch (IOException e) {
e.printStackTrace();
}
за 2ра задача пък проблема пак е при 1вия тест (на последния ред тоя път един интервал повече) , в другите тестове няма .