These are chat archives for ReactiveX/RxJava

Mar 2017
Mar 16 2017 07:54
@devharis Yes, that seems reasonable - one alternative would be to just put a for loop into the map of your original code, thus transforming a List<Assignment> to a new List<Assignment>.
Haris Kljajić
Mar 16 2017 12:54
I don' think that would work because those lists aren't of same type so the return type would not be correct?
AssignmentDTO is the type which the list is of, then we map them to a new list of type Assignment
        return mRetrofit.create(AssignmentService.class).GET("token")
                .flatMapIterable(assignmentDTOs -> {
                    List<Assignment> assignments = new ArrayList<>();
                    for(AssignmentDTO assignmentDTO : assignmentDTOs)
                        assignments.add(mTransformer.transform(assignmentDTO, Assignment.class));

                    return assignments;
Did you mean something like this @DavidMihola ?
Mar 16 2017 16:20
@devharis Yes, that's what I in mind, I just got the types wrong: the input to map is List<AssignmentDTO> and not List<Assignment>. I assume the last snippet works?