in todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/statistics/StatisticsStateBundler.java [30:40]
static Optional<Bundle> statisticsStateToBundle(StatisticsState state) {
return state.map(
loading -> Optional.absent(),
loaded -> {
Bundle bundle = new Bundle();
bundle.putInt("active_count", loaded.activeCount());
bundle.putInt("completed_count", loaded.completedCount());
return Optional.of(bundle);
},
failed -> Optional.absent());
}