1. 程式人生 > >RxJava總結(原)

RxJava總結(原)

-s ble get react ren xtend ima 等待 而是

---恢復內容開始---

1、RxJava的作用  

    RxJava is a Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences.

    It extends the observer pattern to support sequences of data/events and adds operators that allow you to compose sequences together declaratively while abstracting away   concerns about things like low-level threading, synchronization, thread-safety and concurrent data structures.

    說白了就是大家都說的讓你能一眼看出來你之前做什麽,之後做什麽。它不是簡化了代碼,而是簡化了邏輯。它具有線程安全性。

2、RxJava的原理

    RxJava是基於觀察者模式的。用戶定義Observer之後,提供一個Observerble,由Observerble進行subscribe,就安心等待結果就行。

技術分享圖片

3、RxJava的實現

  技術分享圖片

4、RxJava的流程

  技術分享圖片

5、RxJava的使用

RxJava總結(原)