Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RxJava学習のベストプラクティスっぽいもの

yagi
March 17, 2015

 RxJava学習のベストプラクティスっぽいもの

yagi

March 17, 2015
Tweet

More Decks by yagi

Other Decks in Technology

Transcript

  1. w 3FBDUJWF&YUFOTJPOT 3Y ͸ɺ؍ଌՄೳ PCTFSWBCMF ͳγʔέϯεͱ-*/2ελΠϧͷΫ ΤϦԋࢉࢠΛ࢖ͬͯɺඇಉظͳΠϕϯτϕʔεͷϓ ϩάϥϜΛ߹੒͢ΔϥΠϒϥϦͰ͢ɻ3YΛ࢖͏ͱɺ ։ൃऀ͸ඇಉظσʔλετϦʔϜΛ0CTFSWBCMF Ͱද͠ɺඇಉظσʔλετϦʔϜʹର͢ΔΫΤϦ

    ʹ-*/2ԋࢉࢠΛ࢖͍ɺඇಉظετϦʔϜͷฒߦ ੑΛ4DIFEVMFSͰύϥϝλԽ͠·͢ɻ؆୯ʹݴ͑ ͹ɺ3Y0CTFSWBCMF -*/2 4DIFEVMFSͰ͢ɻ 3Y+BWBͱ͸ http://okapies.hateblo.jp/entry/2015/03/04/031148
  2. w 0CTFSWBCMF3FDJQFSFDJQFT0CTFSWBCMFGSPN SFDJQF-JTU  w 0CTFSWBCMF*OUFHFSDPVOUFS0CTFSWBCMFSBOHF    w

     ίϨΫγϣϯΛ0CTFSWBCMFԽ QVCMJDDMBTT999"EBQUFSFYUFOET"SSBZ"EBQUFS5\ QVCMJD0CTFSWBCMF5JUFNT \ SFUVSO0CTFSWBCMF SBOHF  HFU$PVOU  NBQ JHFU*UFN J  XJOEPX HFU$PVOU  UP#MPDLJOH  TJOHMF  ^ ^
  3. ͋ͱ͸ԿͰ΋΍Γ์୊ 0CTFSWBCMF3FDJQFIJTUPSZ0CTFSWBCMFGSPN IJTUPSZ-JTU  0CTFSWBCMF4USJOHJETIJTUPSZ NBQ OFX'VOD3FDJQF -POH \ !0WFSSJEF

    QVCMJD-POHDBMM 3FDJQFSFDJQF \ SFUVSOSFD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