code: public static <U, I> void saveDataModel(final DataModelIF<U, I> dm, final String outfile, final boolean overwrite, final String delimiter)
              throws FileNotFoundException, UnsupportedEncodingException {
          if (new File(outfile).exists() && !overwrite) {
              System.out.println("Ignoring " + outfile);
          } else {
              PrintStream out = new PrintStream(outfile, "UTF-8");
              for (U user : dm.getUsers()) {
                  for (I item : dm.getUserItems(user)) {
                      Double pref = dm.getUserItemPreference(user, item);
                      out.println(user + delimiter + item + delimiter + pref);
                  }
              }
              out.close();
          }
      }
docs: Method that saves a data model to a file.
  
  @param dm the data model
  @param outfile file where the model will be saved
  @param overwrite flag that indicates if the file should be overwritten
  @param delimiter field delimiter
  @param <U> type of users
  @param <I> type of items
  @throws FileNotFoundException when outfile cannot be used.
  @throws UnsupportedEncodingException when the requested encoding (UTF-8)
  is not available.