Skip to content

Commit

Permalink
Merge pull request #25 from junwha0511/dev
Browse files Browse the repository at this point in the history
[Hotfix] Handle duplicate genre inputs
  • Loading branch information
queuedq authored Apr 2, 2021
2 parents 6252148 + 9f2526a commit 346cb63
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/java/com/cse364/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.HashSet;
import java.util.Map;
import java.util.Iterator;

// Input format
// java (filename) genres occupation
Expand All @@ -24,7 +22,7 @@ public static void main(String[] args) {
}

//Preprocess genres and occupation
List<Genre> genres = new ArrayList();
HashSet<Genre> genres = new HashSet();
for (String genreName : args[0].split("\\|")) {
Genre genre = DataLoader.genreStorage.getGenre(genreName);
if (genre == null) {
Expand All @@ -42,7 +40,7 @@ public static void main(String[] args) {
System.exit(0);
}

printAverageRating(genres, occupation);
printAverageRating(new ArrayList<Genre>(genres), occupation);
}

/**
Expand Down

0 comments on commit 346cb63

Please sign in to comment.