Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
渋谷Java #3
Search
mystelynx
September 28, 2013
Programming
2
260
渋谷Java #3
guava totallylazy java8
について
mystelynx
September 28, 2013
Tweet
Share
More Decks by mystelynx
See All by mystelynx
Ansible Study #1
mystelynx
1
330
Apache Commonsに関するお話
mystelynx
2
890
Other Decks in Programming
See All in Programming
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Go の GC の不得意な部分を克服したい
taiyow
2
780
fs2-io を試してたらバグを見つけて直した話
chencmd
0
230
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
1
650
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
260
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
750
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
2
220
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
180
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Navigating Team Friction
lara
183
15k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Into the Great Unknown - MozCon
thekraken
33
1.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Music & Morning Musume
bryan
46
6.2k
The Pragmatic Product Professional
lauravandoore
32
6.3k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Transcript
Java8ɺͪΐͬͱͦͷલʹ ौ୩Java #3 Urakawa Tomohiro / @mystelynx 139݄28༵
ࣗݾհ Urakawa Tomohiro @mystelynx ؋ୂ࢘ྩ෦Level.19 ΫοΩʔ͞Μଔۀ͠·ͨ͠ɻ גࣜձࣾALBERTɹγεςϜ։ൃ෦ ࠷ۙRedshiftͱٔΕ͍ͯ·͢ɻ 139݄28༵
Agenda JavaͰ͑ΔؔܕϥΠϒϥϦ guava-libraries totallylazy ͦΕͧΕͷ༻্ͷҙɾ༻๏ʗ༻ྔͳͲ Java8ͱซ༻͢Δͱʁ 139݄28༵
139݄28༵
guava-libraries https:/ /code.google.com/p/guava-libraries/ ࠷৽όʔδϣϯɿ15.0 (2013/09/06) υΩϡϝϯτ͕݁ߏࡉ͔͘ॻ͔Ε͍ͯΔ ศརͳCollectionUtilitiesͳͲؚΜͰ͍Δ ࠓճؔܕϓϩάϥϛϯάػೳʹ 139݄28༵
ίʔυྫ̍ ݁ߏͬͨΒ͍͠ʢओ؍ 139݄28༵
ίʔυྫ̎ ͔ͦ͜ͱͳ͘υϠײΛײ͡Δʢओ؍ 139݄28༵
ॴײ CharMatcherͳͲᙱ͍ͱ͜Ζʹख͕ಧ͘ ແବʹ࣮͠ͳ͍ͨΊʹɺԿ͕༻ҙ͞Ε ͯΔ͔େମѲ͓ͯ͜͠͏ શମతʹΫϥεʗϝιου໊ΛۃྗΘ͔Γ ͘͢͠Α͏ͱͯ͘͠Ε͍ͯΔײ͕͋Δɻ ٯʹ͔Γʹ͍͘ʁʢmapͩΖ…ͱ͔ʣ 139݄28༵
ҙ Java8ͷඪ४ϥΠϒϥϦͱΫϥε໊͕ඃΔ java.util.function.Function vs com.google.common.base.Function java.util.function.Predicate vs com.google.common.base.Predicate ඍົʹϝιου໊͕׳Εͳ͍ 139݄28༵
139݄28༵
totallylazy https:/ /code.google.com/p/totallylazy/ ࠷৽όʔδϣϯɿ1113 (2013/08/25) υΩϡϝϯτແ͍ʢʀ∀ʀʣ ιʔεʂˠJavaDocແ͍ʢʀ∀ʀʣɹɹɹ ςετˠཏ͞Εͯͳ͍ʢʀ∀ʀʣ 139݄28༵
ઃܭࢥతʹ ClojureͷCollectionͷ༷ʹՄೳͳݶΓԆධՁ MLܥݴޠͷ໊ؔʗϝιου໊Λ౿ऻ HaskellScalaܦݧऀೃછΈ͍͔͢ HamcrestͷMatcherΛPredicateʹ͑Δ static importଟ༻ 139݄28༵
ίʔυྫ̍ େےguavaͱมΘΒͳ͍ɻ mapͱ͔filterͱ͔static import͞Εͯ·͢ 139݄28༵
ίʔυྫ̎ υϠ ιʔεΛݟͳ͕ΒؤுΔ͔͠ͳ͍ؾ͕͢Δ sequence(foo)͕ɺJava8ͷStreamͷΠϝʔδ 139݄28༵
ॴײ ͱʹ͔͘υΩϡϝϯτ͕ແ͍ ઓಆྗͷ͕ܹ͍ࠩ͠ هड़ͱʹ͔͘؆ܿɻJava8ͷϥϜμࣜͰॻ͘ ΑΓ؆ܿɻ 139݄28༵
ҙ Java8ͷඪ४ϥΠϒϥϦͱΫϥε໊͕ඃΔ com.googlecode.totallylazy.Predicate newͰΠϯελϯεੜ͢ΔͷͰͳ ͘ɺSequences, PredicatesͳͲͳͲ͔Β static importͯ͠͏ͷ͕ఆੴ eclipseͩͱ͠ΜͲ͍Πϝʔδʢओ؍ 139݄28༵
139݄28༵
Java8 https:/ /jdk8.java.net/download.html ࠷৽όʔδϣϯɿ8 build b108 2014/03ϦϦʔε༧ఆʂ ؔܕػೳͷଞʹDateTimeͱ͔ɺσϑΥϧ τϝιουͱ͔ 139݄28༵
ίʔυྫ̍ ͜ͷॻ͖ํ͢ΔͱͲΕมΘΒͳ͍Ͱ͢Ͷ 139݄28༵
ίʔυྫ̎ ͜Ε͕Ұ൪͍ؾ͕͢Δ stream()ͯ͠ɺ࠷ޙʹList͢ ϥϜμࣜ͏ͱnew new͠ͳ͍͍ͯ͘ͷͰݟ ͍͢ 139݄28༵
͍ͭͰʹ guava/totallylazyͦΕͧΕϥϜμࣜͰ guava؆ܿʹͳͬͯGood totallylazyʹͳͬͯBad 139݄28༵
·ͱΊ Ϋϥε໊͕ඃͬͯ͘ΔͷͰɺҙ͠Α͏ totallylazy͑Δͱγϯϓϧ ˞ʮ͑Δͱʯ guavaίϨΫγϣϯϢʔςΟϦςΟͳͲ ͳ͑͘Δ 139݄28༵
͓ΘΓ 139݄28༵