Any hint? Tk you!
package com.codegym.task.task17.task1721;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Transactionality
*/
public class Solution {
public static List<String> allLines = new ArrayList<>();
public static List<String> linesForRemoval = new ArrayList<>();
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String name1 = br.readLine();
String name2 = br.readLine();
File file1 = new File(name1);
File file2 = new File(name2);
FileInputStream fileInputStream1 = new FileInputStream(file1);
FileInputStream fileInputStream2 = new FileInputStream(file2);
BufferedReader bufferedReader1 = new BufferedReader(new InputStreamReader(fileInputStream1));
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(fileInputStream2));
while(bufferedReader1.ready()){
allLines.add(bufferedReader1.readLine());
}
while(bufferedReader2.ready()){
linesForRemoval.add(bufferedReader2.readLine());
}
Solution solution = new Solution();
solution.joinData();
}
public void joinData() throws CorruptedDataException {
allLines.removeAll(linesForRemoval); // with this line i remove all identical string from allLines and pass the request
if(!allLines.isEmpty()){
allLines.clear(); // with this line i remove all string from allLines and pass the request but i have an error to line 45
throw new CorruptedDataException();
}
}
}