does the "Collections.sort " method not set in ASCII order ??
package pl.codegym.task.task18.task1821;
/*
Częstotliwość występowania symboli
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
char a = 0;
String txt = "";
List<Character> list = new ArrayList<>();
List<String> list2 = new ArrayList<>();
Set<Character> set = new HashSet<>();
FileReader reader = new FileReader(args[0]);
BufferedReader bufferedReader = new BufferedReader(reader);
while (bufferedReader.ready())
{
list2.add(bufferedReader.readLine());
}
for(int i =0 ; i < list2.size(); i++)
{
txt = list2.get(i);
for(int c = 0; c < txt.length(); c++ ) {
set.add(txt.charAt(c));
}
}
for(Character c : set)
{
list.add(c);
}
Collections.sort(list);
int ilosc = 0;
for(Character c : list)
{
for (int i = 0; i < list2.size(); i++)
{
txt = list2.get(i);
for(int p = 0 ; p < txt.length(); p++)
if(c.equals(txt.charAt(p)))
{
ilosc++;
}
}
System.out.println(c + " "+ilosc);
ilosc=0;
}
reader.close();
bufferedReader.close();
}
}
// for(Character c : list2)
// {
// liczbaASCII = (int) c;
// list3.add(liczbaASCII);
// }
// System.out.println(list3);
// for(Integer i : list3)
// {
// int naChwile = i;
// char c = (char) naChwile;
// list4.add(c);
// }
// List<Integer> list3 = new ArrayList<>();
// List<Character> list4 = new ArrayList<>();
// int liczbaASCII;