что то никак не пойму.
package com.javarush.task.task17.task1721;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Транзакционность
*/
public class Solution {
public static List<String> allLines = new ArrayList<String>();
public static List<String> forRemoveLines = new ArrayList<String>();
public static void main(String[] args) throws IOException,InterruptedException {
BufferedReader userInputFileName = new BufferedReader(new InputStreamReader(System.in));
BufferedReader firstFileReader = null;
BufferedReader secondFileReader = null;
boolean fileFound = true;
//Поиск первого файла
while (fileFound){
try {
System.out.println("Введите путь первого Файла...");
firstFileReader = new BufferedReader(new FileReader(userInputFileName.readLine()));
fileFound = false;
} catch (FileNotFoundException e){
System.out.println("Файл под номером 1 не найден. ");
}
}
fileFound = true;
// Поиск второго файла
while (fileFound){
try{
System.out.println("Введите путь второго Файла...");
secondFileReader = new BufferedReader(new FileReader(userInputFileName.readLine()));
fileFound = false;
} catch (FileNotFoundException e){
System.out.println("Файл под номером 2 не найден.");
}
}
// Запись из текста в Список документ 1
while (firstFileReader.ready()){
allLines.add(firstFileReader.readLine());
}
// Запись из текста в Список документ 2
while (secondFileReader.ready()){
forRemoveLines.add(secondFileReader.readLine());
}
try {
new Solution().joinData();
} catch (IOException e){
e.printStackTrace();
}
userInputFileName.close();
firstFileReader.close();
secondFileReader.close();
}
public void joinData() throws CorruptedDataException {
boolean marker = true;
for(int i = 0; i<allLines.size(); i++){
for (int b = 0; b<forRemoveLines.size(); b++){
if (allLines.get(i).equals(forRemoveLines.get(b))){
allLines.remove(i);
i--;
marker = false;
}
}
}
if (marker){
allLines.clear();
throw new CorruptedDataException();
}
}
}