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
870
Other Decks in Programming
See All in Programming
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
110
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.6k
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
140
Server Driven Compose With Firebase
skydoves
0
400
CSC305 Lecture 13
javiergs
PRO
0
130
VR HMDとしてのVision Pro+ゲーム開発について
yasei_no_otoko
0
100
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
170
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.2k
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
4
330
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
52
32k
僕がつくった48個のWebサービス達
yusukebe
18
17k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
150
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
790
Product Roadmaps are Hard
iamctodd
PRO
48
10k
How GitHub (no longer) Works
holman
311
140k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
Thoughts on Productivity
jonyablonski
67
4.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Code Reviewing Like a Champion
maltzj
519
39k
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༵