废话不多说,直接上代码
List<User> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
User user = new User();
user.id = i + "";
list.add(user);
}
Observable.from(list)
.subscribe(new Action1<User>() {
@Override
public void call(User user) {
System.out.println("MainActivity.call=" + user.id);
}
});