Что не так-то?
package com.javarush.task.task17.task1721;
import java.io.*;
import java.util.*;
/*
Транзакционность
*/
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 FileNotFoundException, IOException {
Solution sln=new Solution();
String filePath1 = null;
String filePath2 = null;
BufferedReader bufread = new BufferedReader(new InputStreamReader(System.in));
filePath1 = bufread.readLine();
filePath2 = bufread.readLine();
bufread.close();
bufread = new BufferedReader(new FileReader(filePath1));
String tmp = null;
while ((tmp = bufread.readLine()) != null) {
allLines.add(tmp);
}
bufread.close();
bufread = new BufferedReader(new FileReader(filePath2));
tmp = null;
while ((tmp = bufread.readLine()) != null) {
forRemoveLines.add(tmp);
}
bufread.close();
sln.joinData();
}
public void joinData() throws CorruptedDataException {
if(forRemoveLines.containsAll(allLines)){
allLines.removeAll(allLines);
}
else{
allLines.clear();
throw new CorruptedDataException();
}
}
}