Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///ZADANIE 3///
- System.out.println("\n///ZADANIE 3///\n");
- Map<String, String> artistRanking = new HashMap<>();
- fr = new FileReader(FILENAME2);
- br = new BufferedReader(fr);
- while ((sCurrentLine = br.readLine()) != null) {
- results = sCurrentLine.split("<SEP>");
- artistRanking.put(results[1], results[2]);
- }
- Map<String, Integer> grupedartistRanking = new HashMap<>();
- fr = new FileReader(FILENAME1);
- br = new BufferedReader(fr);
- while ((sCurrentLine = br.readLine()) != null) {
- results = sCurrentLine.split("<SEP>");
- String value = artistRanking.get(results[1]);
- if(grupedartistRanking.get(value) == null){
- grupedartistRanking.put(value, 1);
- }else{
- int tempval = grupedartistRanking.get(value);
- tempval++;
- grupedartistRanking.put(value, tempval);
- }
- }
- key = Collections.max(grupedartistRanking.entrySet(), Map.Entry.comparingByValue()).getKey();
- System.out.println(key + " " + grupedartistRanking.get(key));
Advertisement
Add Comment
Please, Sign In to add comment