private Observable<Void> saveGameInformationList( List<GameInformation> gameInformationList, int difficulty) { return gsonController .listToJson(gameInformationList) .map(json -> sharedPreferences.edit().putString(getListName(difficulty), json).commit()) .map(x -> null); }
@Override public Observable<List<GameInformation>> getGameInformationList(int difficulty) { return Observable.just(sharedPreferences.getString(getListName(difficulty), "[]")) .flatMap(json -> gsonController.listFromJson(json, GameInformation[].class)); }