interface. • onNext, onError, onComplete public final Subscription subscribe(final Action1<? super T> onNext, final Action1<Throwable> onError, final Action0 onComplete) { /* ... */ }
bridge or proxy that is available in some implementations of ReactiveX that acts both as an observer and as an Observable. • Subject 可以是發送 event 的⼈人 (observable), 也可以是註冊 event 的⼈人 (observer)。 • ⽤用途:Event Bus
cascade of Observable operators, you can do so by instructing those operators (or particular Observables) to operate on particular Schedulers. • 可以利⽤用 Scheduler 來實作 thread 的切換。
return Observable.just(account).map(account1 -> { checkAccount(account); return accountService.login(account); }); } private void checkAccount(Account account) throws IllegalArgumentException { if (TextUtils.isEmpty(account.getEmail()) || TextUtils.isEmpty(account.getPassword())) { throw new IllegalArgumentException("Email or password can not be empty."); } } } public class Account { private final String email; private final String password; public static Account createLoginAccount(final String email, final String password) { return new Account(email, password); } // rest implementation… }