Android 最簡單的rxjava遍歷集合寫法
阿新 • • 發佈:2019-01-22
廢話不多說,直接上程式碼
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);
}
});