I have a list of myPersonList and I want to populate the Name and City of each item. I have already filled in the identifier. I could create a foreach and call FillPersonData, but how can I do this with Observables? I know there is something with Map () and FlatMap () ... but I don't understand it
class Person{
int id;
String name;
String city;
}
List<Person> myPersonList;
what should I do to get an observable list where Person data is filled with this function:
class PersonUtil{
public Person FillPersonData(Person person){
... do something to fill the Person Data...
}
}
Update:
Sorry, my flaw: I did not say that I also need an Observable to subscribe to it. And not the Person class has a function called fillPersonData () ... let me say that I have something like PersonUtil ...
I need this to get it back:
Observable<List<Person>> myObservable = ...the Magic Code :-)
Update 2:
frhack, . , Android Studio Lambdas Lambdas:
Observable<Person> observable = Observable.from(personList)
.filter(new Func1<Person, Boolean>() {
@Override
public Boolean call(Person person) {
PersonUtil.FillMailData(person);
return true;
}
});
, ... ... , Update2!