These are chat archives for ReactiveX/RxJava

30th
Aug 2017
Fyodor Sherstobitov
@fsherstobitov
Aug 30 2017 06:45

Hi! Is there a way to pass the output of one Observable to the input of the second in RxJava2? My task is to get the list of users from server and then save it to the DB. I'm using Retrofit2 for API and Room as ORM on Android. Now I have this code

api.userList()
                .map(new Function<List<UserDto>, List<User>>() {
                    @Override
                    public List<User> apply(@NonNull List<UserDto> userDtos) throws Exception {
                        return userMapper.fromDtoList(userDtos);
                    }
                })

And I need to pass List<User> that I get from map to this method in DAO

@Insert
    Completable insertAll(List<User> users);
Fyodor Sherstobitov
@fsherstobitov
Aug 30 2017 07:50
Found the answer - I must use flatMap to do that
Benoit Lubek
@BoD
Aug 30 2017 12:59
Hi!! I'm trying to find a way to reset a BehaviorSubject... Couldn't find a way - any thoughts?