Transition at RxJava 1.x to 2.x

Transition at RxJava 1.x to 2.x

第2回スタートアップAndroid勉強会
https://connpass.com/event/48090/

Dd17014e380450cfed5d55ff20fa3dfd?s=128

Ryutaro Miyashita

February 01, 2017
Tweet

Transcript

  1. 5SBOTJUJPOBU3Y+BWBYUPY 3Y+BWBYַ׵3Y+BWBYפך獳遤

  2. 3ZVUBSP.JZBTIJUB $IBU8PSL !SZVHPP@

  3. 3Y+BWB  3FBDUJWF&YUFOTJPOTGPSUIF+7.  "OESPJEꟚ涪ַ׵鋅גծ葿ղדֹ׷  ؝ؙٖءّٝ乼⡲  "TZOD5BTLך➿׻׶ 

    %BUBCJOEJOH  +BWB"1*ך➿׻׶  4USFBN  0QUJPOBM  &WFOU#VT
  4. 3Y+BWBY  㸜㹀晛ٔٔ٦أ  3FBDUJWF4USFBNTך➬圫彊䬿  ➭ך㹋鄲חכ"LLB4USFBNTהַ  3Y+BWBYַ׵㢌刿ָ׉ֿ׉ֿ֮׷

  5. 3Y+BWBYח獳遤ׅ׷  (JU)VCך8IBUˏTEJFSFODFJO׾铣׬  ׮ֻ׮ֻה"1*׾刿倜ׅ׷  3Y+BWB鸬䵿ٓ؎ـٓٔ׾،حفر٦زׅ׷  ⹛⡲然钠

  6. /POOVMM Observable.<Void>create(emitter -> { emitter.onNext(null); // NPE });

  7. /POOVMM enum Notification { INSTANCE; } Observable.<Object>create(emitter -> { emitter.onNext(Notification.INSTANCE);

    });
  8. /POOVMM  OVMM׾FNJUׅ׷ֿהכדֹזְ  0CTFSWBCMF7PJEכ0CTFSWBCMF0CKFDUד
 FOVNך⦼׾FNJUׅ׷״ֲח㢌ִ׷  NBQؔلٖ٦ة٦זודSFUVSOOVMM׍ׯ׏ג׋׵
 ⢽ִל/VMM0CKFDUػة٦ٝד㼎䘔ׅ׷ 

    -JHIUXFJHIU4USFBN"1*ה穈׫さ׻ׇג
 ⦼׾0QUJPOBMדٓحفׅ׷ך׮葺ְַ׮
  9. ,JDLTUBSUFSBOESPJEPTT 

  10. #BDLQSFTTVSF Y List<Integer> nums; // Huge list Observable<Integer>create(emitter -> {

    for (int i : nums) { emitter.onNext(i); } }) .onBackPressureBuffer() .subscribe(i -> { /* ignored */ });
  11. #BDLQSFTTVSF Y List<Integer> nums; // Huge list Flowable<Integer>create(emitter -> {

    for (int i : nums) { emitter.onNext(i); } }, BackpressureStrategy.BUFFER) .subscribe(i -> { /* ignored */ });
  12. #BDLQSFTTVSF  0CTFSWBCMFד#BDLQSFTTVSFכ《׶䪔ִזְ  'MPXBCMF׾⢪ֲ  0CTFSWBCMFה'MPXBCMF׾幉㖈ׇׁ׷הֹכ岣䠐  0CTFSWBCMFUP'MPXBCMF 

    'MPXBCMFUP0CTFSWBCMF  'MPXBCMFח㺔ׇ׋倯ָ#BDLQSFTTVSFח㼎䘔דֹ׉ֲ
  13. 4VCKFDU Y Subject<String, String> subject =
 new SerializedSubject(
 PublishSubject.create());

  14. 4VCKFDU Y Subject<String> subject =
 PublishSubject.<String>create()
 .toSerialized(); Processor<String, String> processor

    =
 PublishProcessor.<String>create()
 .toSerialized();
  15. 4VCKFDU  4FSJBMJ[FE4VCKFDUכOFXדכזֻ
 傀㶷ך4VCKFDUַ׵UP4FSJBMJ[FEًاحسד⡲׷  4VCKFDUדכ#BDLQSFTTVSFכ《׶䪔ִזְ  1SPDFTTPS׾⢪ֲ

  16. 4DIFEVMFST Y .subscribeOn(Schedulers.immediate())

  17. 4DIFEVMFST Y .subscribeOn(Schedulers.trampoline())

  18. 4DIFEVMFST  4DIFEVMFSTJNNFEJBUFכYדכ㶷㖈׃זְ  ➿׻׶חUSBNQPMJOF׾⢪ֲ  5ISFBE-PDBMחُؗ٦؎ؚٝ׃ג鷵如Ⳣ椚

  19. 3Y#JOEJOH  3Y#JOEJOHכ7JFXך؎كٝز׾
 0CTFSWBCMFח㢌䳔׃גֻ׸׷  ⥋걾ה㸜䗰ך+BLF8IBSUPO⯓欰⡲ㅷ  植㖈NBTUFSـٓٝثָ3Y+BWBYח
 㼎䘔׃גְ׷ָծ姻䒭ٔٔ٦أָת׌

  20. 3Y#JOEJOH allprojects {
 repositories {
 maven { url 'https://jitpack.io' }


    }
 } compile 'com.github.JakeWharton.RxBinding:rxbinding:71f3a1b'  CVJMEHSBEMF SPPU  CVJMEHSBEMF BQQ ˟SYCJOEJOHBQQDPNQBUWװSYCJOEJOHTVQQPSUW׮ず圫ךغ٦آّٝ䭷㹀ד0,
  21. 3Y+BWBYח獳遤׃ג  ׮ֻ׮ֻה堣唒涸ח縧ֹ䳔ִגְֻ  OVMM׾FNJU׃ג׷ה/1&חז׷ךד岣䠐ָ䗳銲  ずׄせ⵸ך"1*ד׮䮙⹛ָ㢌׻׏ג׷׮ך׮،ٔ  ⢽ִל0CTFSWBCMFUP-JTUכ4JOHMF׾鵤ׅ 

    4JOHMF.BZCF$PNQMFUBCMF׾鵤ׅ㢌刿כ㢳ְ  8IBUTEJFSFOUJO׾擾铣ׅץ׃  ㉏겗搀ֻ麊欽דֹגְ׷
  22. &OKPZ3Y4USFBN-JGF