все как у всех работает, но не нравится валидатору
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>();
private Solution() {
}
private static Solution instance = new Solution();
public static Solution getInstance(){
return instance;
}
public static void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
String one = reader.readLine();
String two = reader.readLine();
BufferedReader br = new BufferedReader(new FileReader(one));
BufferedReader br1 = new BufferedReader(new FileReader(two));
while(br.ready()){
allLines.add(br.readLine());
}
while (br1.ready()){
forRemoveLines.add(br1.readLine());
}
Solution s = Solution.getInstance();
s.joinData();
reader.close();
br.close();
br1.close();
} catch (FileNotFoundException e) {
System.out.println("File not found.");
}
catch (IOException ie){
System.out.println("smth wrong");
}
}
public void joinData() throws CorruptedDataException {
if(allLines.containsAll(forRemoveLines)){
allLines.removeAll(forRemoveLines);
// System.out.println("Done!");
}else{
allLines.clear();
// System.out.println("Bad :(");
throw new CorruptedDataException();}
}
}