예제 #1
0
 private static Map<Integer, List<Integer>> getUserLikes() {
   List<Rating> ratings = DB.getRatings();
   Map<Integer, List<Rating>> userPartitionnedRatings = DataOperation.groupByUser(ratings);
   Map<Integer, List<Integer>> userLikedMovies = new HashMap<Integer, List<Integer>>();
   for (Entry<Integer, List<Rating>> entry : userPartitionnedRatings.entrySet()) {
     Integer userId = entry.getKey();
     userLikedMovies.put(userId, new ArrayList<Integer>());
     for (Rating r : entry.getValue()) {
       if (r.rating() > DB.likeThreshold()) {
         userLikedMovies.get(userId).add(r.movie());
       }
     }
   }
   return userLikedMovies;
 }