KotlinでLet's Reactive

KotlinでLet's Reactive

Kansai.kt#2勉強会資料です。

87e94dd0e8a5f52de58a0e4a0b1a1f3f?s=128

Shinichi Kozake

November 26, 2016
Tweet

Transcript

  1. 6.

    4GCEVKXG 2TQITCOKPI 鱻鲑鱔鲍鲃鲗鱔 鱵鲍鱤鱈鲄 4GCEVKXG 5VTGCO 4GCEVKXG: ↶㲹  4Z,CXC

    飢赙  㨍㣆鰟#IGPFC鰑鰹猳 -QVNKP鰟嵒鰠鯳鰼鯼鰛獑
  2. 7.

     餿勤徨㡺 ʲ຋༁ʳ͋ͳ͕ͨٻΊ͍ͯͨϦΞΫςΟϒϓϩάϥϛϯάೖ໳ IUUQOJOKJOLVOIBUFOBCMPHDPNFOUSZJOUSPSYKB  3FBDUJWF9*OUSPEVDUJPO IUUQSFBDUJWFYJPJOUSPIUNM  3FBDUJWF4USFBNT IUUQTHJUIVCDPNSFBDUJWFTUSFBNTSFBDUJWFTUSFBNTKWNCMPCW3&"%.&NE

     3Y+BWB IUUQTHJUIVCDPN3FBDUJWF93Y+BWBXJLJ  3FBDUJWF8FCΞϓϦέʔγϣϯͦͯ͠4QSJOH΁ IUUQXXXTMJEFTIBSFOFUNBLJOHYSFBDUJWFXFCTQSJOHKKVHDDDDDDFG  3Y+BWBֶशͷϕετϓϥΫςΟεͬΆ͍΋ͷ IUUQTTQFBLFSEFDLDPNTZTZBHJSYKBWBYVFYJGBMTFIFTVUPIVSBLVUFJTVUVIPJNPGBMTF  3Y+BWBʹ೔Ͱೖ໳͠ɺ"OESPJEΞϓϦͷϦετૢ࡞ɺඇಉظॲཧɺมߋ௨஌ͷ՝୊Λղܾͨ͠࿩ IUUQRJJUBDPNZVZB@QSFTUPJUFNTGBEEDGD  4QSJOHʹඋ͑ΔϦΞΫςΟϒϓϩάϥϛϯάೖ໳ IUUQXXXTMJEFTIBSFOFU5BLVZB*XBUTVLBTQSJOH  3FBDUJWF&YUFOTJPOTͷ͸͡Ί͔ͨ IUUQCMPHPL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 4UBSU BOE5JNFS 0CTFSWBCMFͷม׵ 0CTFSWBCMFͷ஋Λม׵͢Δԋࢉࢠɻ #V⒎FS 'MBU.BQ (SPVQ#Z .BQ 4DBO BOE8JOEPX 0CTFSWBCMFͷϑΟϧλϦϯά 0CTFSWBCMFͷ஋Λબ୒ʢϑΟϧλϦϯάʣ͢Δԋࢉࢠ %FCPVODF %JTUJODU &MFNFOU"U 'JMUFS 'JSTU *HOPSF&MFNFOUT -BTU 4BNQMF 4LJQ 4LJQ-BTU  5BLF BOE5BLF-BTU 0CTFSWBCMFͷ݁߹ ෳ਺ͷ0CTFSWBCMFΛͭͷ0CTFSWBCMFʹ͢Δԋࢉࢠ "OE5IFO8IFO $PNCJOF-BUFTU +PJO .FSHF 4UBSU8JUI 4XJUDI BOE;JQ
  10. 40.

     4GCEVKXG: 1RGTCVQT鰟鱏鱪鱘鲎鯮  ΤϥʔϋϯυϦϯάԋࢉࢠ 0CTFSWBCMFͷΤϥʔ௨஌Λ͔Βճ෮͢Δͷʹ໾ཱͭԋࢉࢠ $BUDIBOE3FUSZ ϢʔςΟϦςΟԋࢉࢠ 0CTFSWBCMFTΛૢ࡞͢ΔͨΊͷศརͳԋࢉࢠ %FMBZ

    %P .BUFSJBMJ[F%FNBUFSJBMJ[F 0CTFSWF0O 4FSJBMJ[F 4VCTDSJCF 4VCTDSJCF0O  5JNF*OUFSWBM 5JNFPVU 5JNFTUBNQ BOE6TJOH ৚݅΍ਅِԋࢉࢠ 0CTFSWBCMF·ͨ͸0CTFSWBCMFͷ஋ΛධՁ͢Δԋࢉࢠ "MM "NC $POUBJOT %FGBVMU*G&NQUZ 4FRVFODF&RVBM 4LJQ6OUJM 4LJQ8IJMF 5BLF6OUJM  BOE5BLF8IJMF ਺ֶɾूܭԋࢉࢠ 0CTFSWBCMFͷ஋શͯΛૢ࡞͢Δԋࢉࢠ "WFSBHF $PODBU $PVOU .BY .JO 3FEVDF BOE4VN
  11. 43.

     4GCEVKXG: 5KPING 3Y+BWB͕։ൃͨ͠0CTFSWBCMFͷมछɻ 4JOHMFͷ0CTFSWBCMFͷΑ͏ͳ΋ͷ͕ͩɺෳ਺஋Λग़ྗ͢ΔͷͰ͸ͳ͘ৗʹͭͷ஋·ͨ͸Τϥʔ௨஌͢Δɻ ͜ͷͨΊɺ0CTFSWBCMFͷΑ͏ʹͭͷϝιουʢPO/FYUɺPO&SSPSɺ͓ΑͼPO$PNQMFUFEʣΛ༻͍ͣɺ ͭͷϝιουͷΈΛ؍ଌ TVCTDSJCF ʹ࢖༻͢Δɻ PO4VDDFTT

    4JOHMF͔Β௨஌͞ΕΔҰͭͷ஋Λड͚औΔɻ PO&SSPS 4JOHMF͔Β௨஌͞ΕΔΤϥʔΛड͚औΔɻ 4JOHMF͸͜ͷͲͪΒ͔ͷϝιου͕Ұ͚ͭͩݺͼͩ͢ɻ ϝιου͕ݺͼग़͞ΕΔͱɺߪಡʢTVCTDSJQUJPOʣ͸ऴྃ͢Δɻ 4JOHMF΋0CTFSWBCMFಉ༷ɺ͍͔ͭ͘ͷԋࢉࢠΛ΋͍ͬͯΔɻ
  12. 47.

     4GCEVKXG: 5EJGFWNGTU εέδϡʔϥͰεϨουΛมߋͰ͖Δɻ TVCTDSJCF0O PCTFSWF0O σϑΥϧτಈ࡞Ͱ͸ɺTVCTDSJCFϝιουΛݺ ͼग़ͨ͠εϨου্ͰετϦʔϜͷ؍ଌ ௨஌ ͕ߦΘΕΔ͕ɺ্هϝιουͰͦΕͧΕͷε

    ϨουΛࢦఆͰ͖Δɻ TVCTDSJCF0O͸ͲͷεϨουͰ0CTFSWBCMFͷ ؍ଌΛ͢Δ͔Λࢦఆ͢Δ͔Λࢦఆ͢Δɻͦͷ ͨΊɺϝιουνΣʔϯͷͲ͜Ͱએݴ͢Δ͔͸ Өڹ͠ͳ͍ɻ ҰํͰɺPCTFSWF0O͸એݴޙͷԋࢉ͢Δε ϨουΛมߋ͢Δɻ
  13. 53.

     9JCV U4GCEVKXG5VTGCO! ͭͷΠϯλϑΣʔε 4GCEVKXG5VTGCO QVCMJDJOUFSGBDF1VCMJTIFS5\ QVCMJDWPJETVCTDSJCF 4VCTDSJCFS TVQFS5T 

    ^ QVCMJDJOUFSGBDF4VCTDSJCFS5\ QVCMJDWPJEPO4VCTDSJCF 4VCTDSJQUJPOT  QVCMJDWPJEPO/FYU 5U  QVCMJDWPJEPO&SSPS 5ISPXBCMFU  QVCMJDWPJEPO$PNQMFUF  ^ QVCMJDJOUFSGBDF4VCTDSJQUJPO\ QVCMJDWPJESFRVFTU MPOHO  QVCMJDWPJEDBODFM  ^ QVCMJDJOUFSGBDF1SPDFTTPS5 3FYUFOET4VCTDSJCFS5 1VCMJTIFS3\ ^
  14. 60.

     4Z,CXC 0CTFSWBCMFDSFBUF*OU\F FPO/FYU   FPO/FYU   FPO/FYU

      FPO$PNQMFUF  ^TVCTDSJCF\ QSJOU JU QSJOU   ^ %TGCVG%TGCVG  ࣮ߦ݁Ռ
  15. 62.

     4Z,CXC 0CTFSWBCMFGSPN*UFSBCMF MJTU0G     TVCTDSJCF\ QSJOU

    JU QSJOU   ^ %TGCVG(TQO  ࣮ߦ݁Ռ
  16. 64.

     4Z,CXC 0CTFSWBCMFKVTU     TVCTDSJCF\ QSJOU JU

    QSJOU   ^ %TGCVG,WUV  ࣮ߦ݁Ռ
  17. 66.
  18. 68.

     4Z,CXC 0CTFSWBCMFSBOHF    TUBSU8JUI   TVCTDSJCF\

    QSJOU JU QSJOU   ^ %TGCVG5VCTV  ࣮ߦ݁Ռ
  19. 70.

     4Z,CXC WBMMBUDI$PVOU%PXO-BUDI   0CTFSWBCMFJOUFSWBM  5JNF6OJU4&$0/%4  UBLF

      TVCTDSJCF \ QSJOU JU QSJOU l  ^ \^ \MBUDIDPVOU%PXO ^  MBUDIBXBJU  %TGCVG+PVGTXCN  ࣮ߦ݁Ռ
  20. 72.

     4Z,CXC WBMMBUDI$PVOU%PXO-BUDI   0CTFSWBCMFUJNFS  5JNF6OJU4&$0/%4  TVCTDSJCF

    \ QSJOU JU QSJOU   ^ \^ \MBUDIDPVOU%PXO ^  MBUDIBXBJU  %TGCVG6KOGT  ࣮ߦ݁Ռ
  21. 74.

     4Z,CXC 0CTFSWBCMFKVTU     NBQ\JU ^ TVCTDSJCF\

    QSJOU JU QSJOU   ^ 1RGTCVQT/CR  ࣮ߦ݁Ռ
  22. 76.

     4Z,CXC 0CTFSWBCMFKVTU       

    pMUFS\JU^ TVCTDSJCF\ QSJOU JU QSJOU   ^ 1RGTCVQT(KNVGT  ࣮ߦ݁Ռ
  23. 78.

     4Z,CXC 0CTFSWBCMFKVTU     qBU.BQ\0CTFSWBCMFSBOHF  JU

    ^ TVCTDSJCF\ QSJOU JU QSJOU   ^ 1RGTCVQT(NCV/CR  ࣮ߦ݁Ռ
  24. 80.

     4Z,CXC 0CTFSWBCMFKVTU       HSPVQ#Z\JU^

    CMPDLJOH4VCTDSJCF\ QSJOU LFZ JULFZ WBM JUCMPDLJOH*UFSBCMF UP-JTU QSJOUMO  ^ 1RGTCVQT)TQWR$[ LFZWBM<  > LFZWBM< > ࣮ߦ݁Ռ
  25. 82.

     4Z,CXC 0CTFSWBCMFKVTU      TLJQ 

     TVCTDSJCF\ QSJOU JU QSJOU   ^ 1RGTCVQT5MKR  ࣮ߦ݁Ռ
  26. 84.

     4Z,CXC 1RGTCVQT6CMG 0CTFSWBCMFKVTU      UBLF

      TVCTDSJCF\ QSJOU JU QSJOU   ^  ࣮ߦ݁Ռ
  27. 86.

     4Z,CXC WBMMBUDI$PVOU%PXO-BUDI   0CTFSWBCMFJOUFSWBM3BOHF    

    5JNF6OJU4&$0/%4 NBQ\JU ^ NFSHF8JUI  0CTFSWBCMFJOUFSWBM3BOHF     5JNF6OJU4&$0/%4 NBQ\-^  TVCTDSJCF \ QSJOU JU QSJOU   ^ \^ \MBUDIDPVOU%PXO ^  MBUDIBXBJU  1RGTCVQT/GTIG  ࣮ߦ݁Ռ
  28. 88.

     4Z,CXC 0CTFSWBCMFKVTU       [JQ8JUI

     0CTFSWBCMFKVTU " # $ %  #J'VODUJPO*OU 4USJOH 4USJOH\O TOUP4USJOH  T^  TVCTDSJCF\ QSJOU JU QSJOU   ^ 1RGTCVQT<KR "#$% ࣮ߦ݁Ռ
  29. 90.

     4Z,CXC 0CTFSWBCMFKVTU       BMM\JU^

    TVCTDSJCF \ QSJOU JU QSJOU   ^ \^  1RGTCVQT#NN USVF ࣮ߦ݁Ռ
  30. 92.

     4Z,CXC 0CTFSWBCMFKVTU       SFEVDF\O

    NO N^ TVCTDSJCF\ QSJOU JU QSJOU   ^ 1RGTCVQT4GFWEG  ࣮ߦ݁Ռ
  31. 94.

     4Z,CXC WBSFSSUSVF 0CTFSWBCMFDSFBUF*OU\F FPO/FYU   FPO/FYU  

    JG FSS \ FPO&SSPS 3VOUJNF&YDFQUJPO UFTU  FSSGBMTF ^ FPO/FYU   FPO$PNQMFUF  ^SFUSZ  TVCTDSJCF\ QSJOU JU QSJOU   ^ 1RGTCVQT4GVT[  ࣮ߦ݁Ռ
  32. 96.

     4Z,CXC GVODSFBUF&YFDVUPS OBNF4USJOH &YFDVUPSTOFX4JOHMF5ISFBE&YFDVUPS\S5ISFBE S OBNF ^ WBMMBUDI$PVOU%PXO-BUDI 

     0CTFSWBCMFDSFBUF*OU\FQSJOUMO DSFBUF 5ISFBEDVSSFOU5ISFBE OBNF  FPO/FYU  FPO/FYU  FPO/FYU  FPO$PNQMFUF  ^ PCTFSWF0O 4DIFEVMFSTGSPN DSFBUF&YFDVUPS PCTFSWF  NBQ\QSJOUMO NBQ 5ISFBEDVSSFOU5ISFBE OBNF  JU  ^ TVCTDSJCF0O 4DIFEVMFSTGSPN DSFBUF&YFDVUPS TVCTDSJCF  PCTFSWF0O 4DIFEVMFSTGSPN DSFBUF&YFDVUPS PCTFSWF  TVCTDSJCF \QSJOUMO TVCTDSJCF 5ISFBEDVSSFOU5ISFBE OBNF  QSJOUMO JU  ^ \^ \MBUDIDPVOU%PXO ^  MBUDIBXBJU  5EJGFWNGTU1DUGTXG1P5WDUETKDG1P
  33. 98.