Is it correct to modify object inside reactive flow, when it was defined outside of it?
Example:
public Single<MyDto> createDto() {
MyDto dto = new MyDto();
return Single.just(“testUserName”)
.flatmap(userName -> return userService.findUserById(userName)
.map(user->{
dto.setId(user.getId());
return dto;
});
)
};
UserService does rest call to get User and returns Single <User>
.
Can there be a case when I would get myDto with empty ‘id’ field?