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 ( ) ; } }
Method that saves a data model to a file .