There is no way to find an answer to two questions. Suppose from a retrofit an Observable object comes to us, of the form of something like
private String id; private List<String> list; public List<String> getList(){return list}; Yes, we can get our .subscribe(o->workWithObject(o)) object .subscribe(o->workWithObject(o)) where we’ll get our list, create an observable and work with it Observable.fromIterable(ourObject.getList()) . The question is whether it can be made more elegant, that is
retrofitService.get() .subscribeOn(Schedulers.io()) .{вот например здесь достаем из нашего потока одного объекта массив и работаем уже с ним} .take(10) .... .observeOn(AndroidSchedulers.mainThread()) Hope I managed to explain.
The second question: also in rxjava2, how to replace each element in the stream with a new object. For example, there is a map(s->s.toLowerCase()) and how to do ( s-> new Smth(s) )
Thank you in advance.