我完全不了解 RxJava
,今天一整天都在学习它,现在我在考虑如何解决这个问题:
我有一个由 Retrofit
获取的对象,其中包含两个 ArrayLists
,我需要分别处理每个列表。目前的情况是:
apiService.getUser(token).enqueue(new Callback<User>() {
@Override
public void onResponse(Response<User> response) {
final User user = response.body();
for (Skill s : user.getSkills()) {
// process here first ArrayList
}
for (OrganizerAction o : user.getOrganizerActions()) {
// process here second ArrayList
}
}
@Override
public void onFailure(Throwable t) {
t.printStackTrace();
}
});
更新:
public class User {
// fields
@SerializedName("organizer_actions")
@Expose
private List<OrganizerAction> mOrganizerActions;
@SerializedName("skills")
@Expose
private List<Skill> mSkills;
public List<OrganizerAction> getOrganizerActions() {
return mOrganizerActions;
}
public List<Skill> getSkills() {
return mSkills;
}
}
谢谢,
安东