help
package com.javarush.task.task19.task1919;
import java.io.*;
import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
/*
Считаем зарплаты
*/
public class Solution {
public static void main(String[] args) throws IOException {
//BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileReader file = new FileReader(args[0]);
HashMap<Double, String> map = new HashMap<>();
Map<String, Double> map2 = new TreeMap<>();
ArrayList<String> list1 = new ArrayList<>();
ArrayList<Double> list2 = new ArrayList<>();
Scanner scan = new Scanner(file);
char x;
while (scan.hasNextLine()) {
String s = scan.nextLine();
Pattern p = Pattern.compile("[\\S]+");
Matcher m = p.matcher(s);
while (m.find()) {
list1.add(m.group());
}
}
for (int i = 0; i < list1.size(); i++) {
map.put(Double.valueOf(list1.get(i + 1)), list1.get(i));
i++;
}
for (HashMap.Entry<Double, String> entry : map.entrySet()) {
double d = 0.0;
for (HashMap.Entry<Double, String> entry1 : map.entrySet()) {
if (entry.getValue().equals(entry1.getValue())) {
d += entry1.getKey();
}
}
map2.put(entry.getValue(), d);
}
for(HashMap.Entry<String, Double> entry:map2.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
file.close();
}
}