任何時(shí)候,只要在另一個(gè)Observable發(fā)射的數(shù)據(jù)定義的時(shí)間窗口內(nèi),這個(gè)Observable發(fā)射了一條數(shù)據(jù),就結(jié)合兩個(gè)Observable發(fā)射的數(shù)據(jù)。
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/join.c.png" alt="join" />
Join操作符結(jié)合兩個(gè)Observable發(fā)射的數(shù)據(jù),基于時(shí)間窗口(你定義的針對(duì)每條數(shù)據(jù)特定的原則)選擇待集合的數(shù)據(jù)項(xiàng)。你將這些時(shí)間窗口實(shí)現(xiàn)為一些Observables,它們的生命周期從任何一條Observable發(fā)射的每一條數(shù)據(jù)開(kāi)始。當(dāng)這個(gè)定義時(shí)間窗口的Observable發(fā)射了一條數(shù)據(jù)或者完成時(shí),與這條數(shù)據(jù)關(guān)聯(lián)的窗口也會(huì)關(guān)閉。只要這條數(shù)據(jù)的窗口是打開(kāi)的,它將繼續(xù)結(jié)合其它Observable發(fā)射的任何數(shù)據(jù)項(xiàng)。你定義一個(gè)用于結(jié)合數(shù)據(jù)的函數(shù)。
http://wiki.jikexueyuan.com/project/rx-docs/images/operators/groupJoin.c.png" alt="groupJoin" />
很多ReactiveX實(shí)現(xiàn)還有一個(gè)類(lèi)似的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類(lèi)中也有一個(gè)join操作符。它將一個(gè)發(fā)射字符串序列的Observable轉(zhuǎn)換為一個(gè)發(fā)射單個(gè)字符串的Observable,join操作符使用指定的定界符將全部單獨(dú)的字符串連接起來(lái)。