I don't know what I'm missing...
package com.codegym.task.task18.task1823;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/*
Threads and bytes
*/
public class Solution {
public static Map<String, Integer> resultMap = new HashMap<String, Integer>();
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
String pathName;
while(true){
pathName = reader.readLine();
if(pathName.equals("exit")){
break;
}
ReadThread rt = new ReadThread(pathName);
rt.start();
}
reader.close();
}
public static class ReadThread extends Thread {
String fn;
public ReadThread(String fileName) throws IOException {
// Implement constructor body
this.fn = fileName;
}
// Implement file reading here
public void run(){
ArrayList<Object> list = new ArrayList<>();
HashMap<String,Integer> resultMap = new HashMap<>();
try {
FileInputStream fis = new FileInputStream(fn);
while (fis.available() > 0) {
int x = fis.read();
list.add(x);
}
int highesFreq = 0;
Integer mapValue = 0;
for(Object o : list){
int frequency = Collections.frequency(list, o);
if (frequency > highesFreq){
highesFreq = frequency;
mapValue = (Integer) o;
}
}
resultMap.put(fn, mapValue);
fis.close();
}catch(IOException e){}
}
}
}