code: @Override
      public void addPreference(final U u, final I i, final Double d) {
          // update direct map
          Map<I, Double> userPreferences = userItemPreferences.get(u);
          if (userPreferences == null) {
              userPreferences = new HashMap<>();
              userItemPreferences.put(u, userPreferences);
          }
          Double preference = userPreferences.get(i);
          if (preference == null) {
              preference = 0.0;
          } else if (ignoreDuplicatePreferences) {
              // if duplicate preferences should be ignored, then we do not take into account the new value
              preference = null;
          }
          if (preference != null) {
              preference += d;
              userPreferences.put(i, preference);
          }
          // update items
          items.add(i);
      }
docs: Method that adds a preference to the model between a user and an item.
  
  @param u the user.
  @param i the item.
  @param d the preference.