任何時候,只要在另一個Observable發(fā)射的數(shù)據(jù)定義的時間窗口內(nèi),這個Observable發(fā)射了一條數(shù)據(jù),就結(jié)合兩個Observable發(fā)射的數(shù)據(jù)。
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/join.c.png" alt="join" />
Join
操作符結(jié)合兩個Observable發(fā)射的數(shù)據(jù),基于時間窗口(你定義的針對每條數(shù)據(jù)特定的原則)選擇待集合的數(shù)據(jù)項。你將這些時間窗口實現(xiàn)為一些Observables,它們的生命周期從任何一條Observable發(fā)射的每一條數(shù)據(jù)開始。當(dāng)這個定義時間窗口的Observable發(fā)射了一條數(shù)據(jù)或者完成時,與這條數(shù)據(jù)關(guān)聯(lián)的窗口也會關(guān)閉。只要這條數(shù)據(jù)的窗口是打開的,它將繼續(xù)結(jié)合其它Observable發(fā)射的任何數(shù)據(jù)項。你定義一個用于結(jié)合數(shù)據(jù)的函數(shù)。
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/groupJoin.c.png" alt="groupJoin" />
很多ReactiveX實現(xiàn)還有一個類似的GroupJoin
操作符。
Most ReactiveX implementations that have a Join operator also have a GroupJoin operator that is similar, except that the function you define to combine items emitted by the two Observables pairs individual items emitted by the source Observable not with an item from the second Observable, but with an Observable that emits items from the second Observable that fall in the same window.
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/join_.png" alt="join" />
The join
operator takes four parameters:
join
默認(rèn)不在任何特定的調(diào)度器上執(zhí)行。
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/groupJoin.png" alt="groupJoin" />
The groupJoin
operator takes four parameters:
groupJoin
默認(rèn)不在任何特定的調(diào)度器上執(zhí)行。
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/St.join.png" alt="st.join" />
可選的StringObservable
類中也有一個join
操作符。它將一個發(fā)射字符串序列的Observable轉(zhuǎn)換為一個發(fā)射單個字符串的Observable,join
操作符使用指定的定界符將全部單獨的字符串連接起來。