コード例 #1
0
 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);
 }
コード例 #2
0
 @Override
 public Observable<List<GameInformation>> getGameInformationList(int difficulty) {
   return Observable.just(sharedPreferences.getString(getListName(difficulty), "[]"))
       .flatMap(json -> gsonController.listFromJson(json, GameInformation[].class));
 }