List<Preference> trainingPrefs = null;
List<Preference> testPrefs = null;
PreferenceArray prefs = dataModel.getPreferencesFromUser(userID);
int size = prefs.length();
for (int i = 0; i < size; i++) {
Preference newPref = new GenericPreference(userID, prefs.getItemID(i), prefs.getValue(i));
if (random.nextDouble() < trainingPercentage) {
if (trainingPrefs == null) {
trainingPrefs = new ArrayList<Preference>(3);
}
trainingPrefs.add(newPref);