Валидатор пишет что не считываются данные, а также метод joinData не в main?
package com.javarush.task.task17.task1721;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/*
Транзакционность
*/
public class Solution {
public static List<String> allLines = new ArrayList<>();
public static List<String> forRemoveLines = new ArrayList<>();
public static String firstFile;
public static String secondFile;
public static volatile boolean isStopped;
static {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))){
firstFile = reader.readLine();
secondFile = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws InterruptedException, CorruptedDataException {
ReadFileThread thread = new ReadFileThread();
Solution solution = new Solution();
thread.setFileName(firstFile);
thread.setList(allLines);
thread.start();
thread.setFileName(secondFile);
thread.setList(forRemoveLines);
thread.start();
isStopped = true;
solution.joinData();
}
public void joinData() throws CorruptedDataException {
for (String forRemoveLine : forRemoveLines) {
if (allLines.contains(forRemoveLine)) {
allLines.remove(forRemoveLine);
} else {
allLines.clear();
}
}
}
public static class ReadFileThread extends Thread{
String s;
List<String> superList = new ArrayList<>();
String fileName;
public void setFileName(String name){
this.fileName = name;
}
public void setList(List<String> list){
this.superList = list;
}
@Override
public void run() {
while(!isStopped){
try {
Scanner scanner = new Scanner(new FileReader(fileName));
while (scanner.hasNext()){
s = scanner.nextLine();
superList.add(s);
scanner.close();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
}}