Здравствуйте, подскажите пожалуйста, что может не нравится валидатору, я конечно понимаю что мой код такой себе, но вроде как считает, а валик не пропускает
package com.javarush.task.task18.task1823;
import java.io.*;
import java.util.*;
/*
Нити и байты
*/
public class Solution {
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) throws IOException, InterruptedException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<>();
while (true){
String s = bf.readLine();
if(s.equals("exit")){
break;
}
list.add(s);
}
for (String s : list){
ReadThread thread = new ReadThread(s);
thread.start();
thread.join();
}
System.out.println(resultMap);
}
public static class ReadThread extends Thread {
private String fileName = null;
ArrayList <Byte> list = new ArrayList<>();
public ReadThread(String fileName) throws IOException {
//implement constructor body
this.fileName = fileName;
setName(fileName);
FileInputStream fis = new FileInputStream(fileName);
while (fis.available() > 0) {
list.add((byte)fis.read());
}
fis.close();
}
// implement file reading here - реализуйте чтение из файла тут
@Override
public void run() {
TreeMap <Byte, Integer> map = new TreeMap<>();
int count = 1;
for (int i = 0; i < list.size(); i++) {
if (!map.containsKey(list.get(i))){
map.put(list.get(i) , count );
}
else {
for (Map.Entry<Byte, Integer> pair : map.entrySet()){
Byte key = pair.getKey();
Integer value = pair.getValue();
if (key == list.get(i)){
map.put(key, ++value );
}
}
}
}
resultMap.put(Thread.currentThread().getName(), Collections.max(map.values()));
}
}
}