These are chat archives for ReactiveX/RxJava

23rd
Jul 2016
r é m i 
@remirobert
Jul 23 2016 09:47
Hi everyone, I am trying to do something with RxJava, I have a List of N Observable, which return the same kind of value. All of the Observables are async. I want to combine all of them and subscribe an List of [Value].
What can I use ? Zip, or combine ?
I don't know how to use FunN
Behzodbek Qodirov
@behzodbek
Jul 23 2016 10:43
Hi guys!
I'm wondering about creating pure function and I need your help guys!

Let's say I have 2 kind of classes and I have to write mapper function.
I need to map from

public class PlayListEntity {
//another vars
    private CategoryEntity category;
}

into

public class PlayList  {
//another vars
    private Category category;
}
I've a class mapper
@Singleton
public class PlaylistEntityDataMapper implements Function<PlayList, PlayListEntity> {
    @Inject
    public PlaylistEntityDataMapper() {
    }

    @Override
    public PlayList map(PlayListEntity entity) {
        PlayList playList=new PlayList();
     // Convert here entity into playlist
        return playList;
    }
}
Behzodbek Qodirov
@behzodbek
Jul 23 2016 10:49
The problem is: in order to map my PlaylistEntity into Playlist I need mapper function for Category, meanwhile, Pure function does not depend on another objects.
How to write independent mapper? Or how to map like this structures with RxJava?
Dorus
@Dorus
Jul 23 2016 10:51
@remirobert Do they all return the same value? N values? You can indeed use zip: Observable.zip(Ob1, Ob2, Ob3, (v1, v2, v3) -> {...})
Wont work if they return a independent number of values.
@behzodbek I cant read that. Use a 4 space jump or surround with
```Java
[your code]
```
(you can edit)
Behzodbek Qodirov
@behzodbek
Jul 23 2016 10:55
@Dorus Done
Dorus
@Dorus
Jul 23 2016 10:57
They can depend on a local object right?
Would still be pure
You can even do withLatestFrom(CatMapperObj)
Behzodbek Qodirov
@behzodbek
Jul 23 2016 11:02
I've a class with a inner field which is not premetive. Inner fields have to be converted too
I need another converter for inner type...
how to implement with RX?
Dorus
@Dorus
Jul 23 2016 11:28
You lost me at 'premetive'
Behzodbek Qodirov
@behzodbek
Jul 23 2016 18:26
@Dorus I mean primitive
Behzodbek Qodirov
@behzodbek
Jul 23 2016 18:44
Another problem here:
What I need:
  1. App should fetch data from database and show that old data.
  2. Start Async request in order to fetch data from REST API
  3. Update DB
  4. Update UI
    (Data base model and RestAPI models are not the same class)
How to implement this scenario with RXJava more properly?